docorbit 0.1.0 → 0.1.1

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 (402) hide show
  1. package/bin/docorbit.js +2 -2
  2. package/dist/apps/cli/src/commands/add.d.ts +7 -0
  3. package/dist/apps/cli/src/commands/add.js +35 -0
  4. package/dist/apps/cli/src/commands/api.d.ts +2 -0
  5. package/dist/apps/cli/src/commands/api.js +35 -0
  6. package/dist/apps/cli/src/commands/context.d.ts +10 -0
  7. package/dist/apps/cli/src/commands/context.js +36 -0
  8. package/dist/apps/cli/src/commands/dashboard.d.ts +8 -0
  9. package/dist/apps/cli/src/commands/dashboard.js +43 -0
  10. package/dist/apps/cli/src/commands/diff.d.ts +2 -0
  11. package/dist/apps/cli/src/commands/diff.js +29 -0
  12. package/dist/apps/cli/src/commands/evaluate.d.ts +11 -0
  13. package/dist/apps/cli/src/commands/evaluate.js +101 -0
  14. package/dist/apps/cli/src/commands/examples.d.ts +2 -0
  15. package/dist/apps/cli/src/commands/examples.js +36 -0
  16. package/dist/apps/cli/src/commands/export.d.ts +11 -0
  17. package/dist/apps/cli/src/commands/export.js +72 -0
  18. package/dist/apps/cli/src/commands/impact.d.ts +2 -0
  19. package/dist/apps/cli/src/commands/impact.js +30 -0
  20. package/dist/apps/cli/src/commands/init.d.ts +5 -0
  21. package/dist/apps/cli/src/commands/init.js +52 -0
  22. package/dist/apps/cli/src/commands/inspect.d.ts +5 -0
  23. package/dist/apps/cli/src/commands/inspect.js +24 -0
  24. package/dist/apps/cli/src/commands/mcp.d.ts +8 -0
  25. package/dist/apps/cli/src/commands/mcp.js +49 -0
  26. package/dist/apps/cli/src/commands/pitfalls.d.ts +2 -0
  27. package/dist/apps/cli/src/commands/pitfalls.js +35 -0
  28. package/dist/apps/cli/src/commands/recipes.d.ts +2 -0
  29. package/dist/apps/cli/src/commands/recipes.js +33 -0
  30. package/dist/apps/cli/src/commands/search.d.ts +11 -0
  31. package/dist/apps/cli/src/commands/search.js +36 -0
  32. package/dist/apps/cli/src/commands/update.d.ts +6 -0
  33. package/dist/apps/cli/src/commands/update.js +53 -0
  34. package/dist/apps/cli/src/commands/verify.d.ts +2 -0
  35. package/dist/apps/cli/src/commands/verify.js +44 -0
  36. package/dist/apps/cli/src/formatters/colors.d.ts +21 -0
  37. package/dist/apps/cli/src/formatters/colors.js +22 -0
  38. package/dist/apps/cli/src/formatters/inspection.d.ts +3 -0
  39. package/dist/apps/cli/src/formatters/inspection.js +88 -0
  40. package/dist/apps/cli/src/formatters/knowledge.d.ts +5 -0
  41. package/dist/apps/cli/src/formatters/knowledge.js +229 -0
  42. package/dist/apps/cli/src/formatters/retrieval.d.ts +3 -0
  43. package/dist/apps/cli/src/formatters/retrieval.js +61 -0
  44. package/{apps/cli/src/formatters/terminal.ts → dist/apps/cli/src/formatters/terminal.d.ts} +0 -1
  45. package/dist/apps/cli/src/formatters/terminal.js +5 -0
  46. package/dist/apps/cli/src/formatters/verification.d.ts +4 -0
  47. package/dist/apps/cli/src/formatters/verification.js +102 -0
  48. package/dist/apps/cli/src/index.d.ts +1 -0
  49. package/dist/apps/cli/src/index.js +376 -0
  50. package/dist/packages/core/src/dashboard/server.d.ts +33 -0
  51. package/dist/packages/core/src/dashboard/server.js +267 -0
  52. package/dist/packages/core/src/dashboard/ui.d.ts +5 -0
  53. package/{packages/core/src/dashboard/ui.ts → dist/packages/core/src/dashboard/ui.js} +2 -2
  54. package/dist/packages/core/src/implementation-service.d.ts +73 -0
  55. package/dist/packages/core/src/implementation-service.js +325 -0
  56. package/{packages/core/src/index.ts → dist/packages/core/src/index.d.ts} +0 -1
  57. package/dist/packages/core/src/index.js +6 -0
  58. package/dist/packages/core/src/inspector.d.ts +22 -0
  59. package/dist/packages/core/src/inspector.js +38 -0
  60. package/dist/packages/core/src/pipeline.d.ts +45 -0
  61. package/dist/packages/core/src/pipeline.js +246 -0
  62. package/dist/packages/crawler/src/config.d.ts +2 -0
  63. package/dist/packages/crawler/src/config.js +10 -0
  64. package/dist/packages/crawler/src/fetcher.d.ts +31 -0
  65. package/dist/packages/crawler/src/fetcher.js +139 -0
  66. package/dist/packages/crawler/src/index.js +2 -0
  67. package/dist/packages/discovery/src/index.d.ts +11 -0
  68. package/dist/packages/discovery/src/index.js +29 -0
  69. package/dist/packages/discovery/src/provider.d.ts +12 -0
  70. package/dist/packages/discovery/src/provider.js +30 -0
  71. package/dist/packages/discovery/src/providers/generic.d.ts +7 -0
  72. package/dist/packages/discovery/src/providers/generic.js +94 -0
  73. package/dist/packages/discovery/src/providers/github.d.ts +7 -0
  74. package/dist/packages/discovery/src/providers/github.js +52 -0
  75. package/dist/packages/discovery/src/providers/llms-txt.d.ts +7 -0
  76. package/dist/packages/discovery/src/providers/llms-txt.js +60 -0
  77. package/dist/packages/discovery/src/providers/markdown.d.ts +7 -0
  78. package/dist/packages/discovery/src/providers/markdown.js +38 -0
  79. package/dist/packages/discovery/src/providers/openapi.d.ts +7 -0
  80. package/dist/packages/discovery/src/providers/openapi.js +77 -0
  81. package/dist/packages/discovery/src/providers/sitemap.d.ts +7 -0
  82. package/dist/packages/discovery/src/providers/sitemap.js +53 -0
  83. package/dist/packages/discovery/src/providers/skill.d.ts +7 -0
  84. package/dist/packages/discovery/src/providers/skill.js +46 -0
  85. package/dist/packages/discovery/src/ranker.d.ts +6 -0
  86. package/dist/packages/discovery/src/ranker.js +107 -0
  87. package/dist/packages/evaluation/src/dataset.d.ts +2 -0
  88. package/dist/packages/evaluation/src/dataset.js +944 -0
  89. package/dist/packages/evaluation/src/index.js +8 -0
  90. package/dist/packages/evaluation/src/runner.d.ts +7 -0
  91. package/dist/packages/evaluation/src/runner.js +196 -0
  92. package/dist/packages/evaluation/src/strategies/context7-runner.d.ts +24 -0
  93. package/dist/packages/evaluation/src/strategies/context7-runner.js +229 -0
  94. package/dist/packages/evaluation/src/strategies/docorbit-runner.d.ts +5 -0
  95. package/dist/packages/evaluation/src/strategies/docorbit-runner.js +210 -0
  96. package/dist/packages/evaluation/src/strategies/firecrawl-runner.d.ts +24 -0
  97. package/dist/packages/evaluation/src/strategies/firecrawl-runner.js +151 -0
  98. package/dist/packages/evaluation/src/strategies/web-search-runner.d.ts +32 -0
  99. package/dist/packages/evaluation/src/strategies/web-search-runner.js +161 -0
  100. package/dist/packages/evaluation/src/types.d.ts +15 -0
  101. package/dist/packages/evaluation/src/types.js +1 -0
  102. package/dist/packages/evaluation/src/version-matcher.d.ts +11 -0
  103. package/dist/packages/evaluation/src/version-matcher.js +61 -0
  104. package/dist/packages/export/src/agents-md.d.ts +19 -0
  105. package/dist/packages/export/src/agents-md.js +170 -0
  106. package/dist/packages/export/src/claude-md.d.ts +17 -0
  107. package/dist/packages/export/src/claude-md.js +118 -0
  108. package/dist/packages/export/src/docs-map.d.ts +14 -0
  109. package/dist/packages/export/src/docs-map.js +118 -0
  110. package/dist/packages/export/src/index.js +6 -0
  111. package/dist/packages/export/src/llms-txt.d.ts +15 -0
  112. package/dist/packages/export/src/llms-txt.js +73 -0
  113. package/dist/packages/export/src/service.d.ts +23 -0
  114. package/dist/packages/export/src/service.js +210 -0
  115. package/dist/packages/export/src/skill-md.d.ts +14 -0
  116. package/dist/packages/export/src/skill-md.js +107 -0
  117. package/{packages/mcp/src/index.ts → dist/packages/mcp/src/index.d.ts} +2 -35
  118. package/dist/packages/mcp/src/index.js +6 -0
  119. package/dist/packages/mcp/src/resources/index.d.ts +12 -0
  120. package/dist/packages/mcp/src/resources/index.js +165 -0
  121. package/dist/packages/mcp/src/server.d.ts +30 -0
  122. package/dist/packages/mcp/src/server.js +243 -0
  123. package/dist/packages/mcp/src/tools/analyze-impact.d.ts +6 -0
  124. package/dist/packages/mcp/src/tools/analyze-impact.js +64 -0
  125. package/dist/packages/mcp/src/tools/check-api.d.ts +6 -0
  126. package/dist/packages/mcp/src/tools/check-api.js +74 -0
  127. package/dist/packages/mcp/src/tools/diff-docs.d.ts +6 -0
  128. package/dist/packages/mcp/src/tools/diff-docs.js +58 -0
  129. package/dist/packages/mcp/src/tools/export-context.d.ts +6 -0
  130. package/dist/packages/mcp/src/tools/export-context.js +61 -0
  131. package/dist/packages/mcp/src/tools/find-api.d.ts +6 -0
  132. package/dist/packages/mcp/src/tools/find-api.js +91 -0
  133. package/dist/packages/mcp/src/tools/find-example.d.ts +6 -0
  134. package/dist/packages/mcp/src/tools/find-example.js +92 -0
  135. package/dist/packages/mcp/src/tools/find-pitfall.d.ts +6 -0
  136. package/dist/packages/mcp/src/tools/find-pitfall.js +85 -0
  137. package/dist/packages/mcp/src/tools/find-recipe.d.ts +6 -0
  138. package/dist/packages/mcp/src/tools/find-recipe.js +89 -0
  139. package/dist/packages/mcp/src/tools/get-doc.d.ts +6 -0
  140. package/dist/packages/mcp/src/tools/get-doc.js +118 -0
  141. package/dist/packages/mcp/src/tools/get-docs-map.d.ts +6 -0
  142. package/dist/packages/mcp/src/tools/get-docs-map.js +54 -0
  143. package/dist/packages/mcp/src/tools/get-version.d.ts +6 -0
  144. package/dist/packages/mcp/src/tools/get-version.js +104 -0
  145. package/dist/packages/mcp/src/tools/implementation-context.d.ts +6 -0
  146. package/dist/packages/mcp/src/tools/implementation-context.js +82 -0
  147. package/dist/packages/mcp/src/tools/index.d.ts +18 -0
  148. package/dist/packages/mcp/src/tools/index.js +39 -0
  149. package/dist/packages/mcp/src/tools/list-sources.d.ts +6 -0
  150. package/dist/packages/mcp/src/tools/list-sources.js +76 -0
  151. package/dist/packages/mcp/src/tools/search-docs.d.ts +6 -0
  152. package/dist/packages/mcp/src/tools/search-docs.js +113 -0
  153. package/dist/packages/mcp/src/tools/types.d.ts +22 -0
  154. package/dist/packages/mcp/src/tools/types.js +1 -0
  155. package/dist/packages/mcp/src/transports/http.d.ts +31 -0
  156. package/dist/packages/mcp/src/transports/http.js +215 -0
  157. package/dist/packages/mcp/src/transports/stdio.d.ts +22 -0
  158. package/dist/packages/mcp/src/transports/stdio.js +86 -0
  159. package/{packages/mcp/src/transports/types.ts → dist/packages/mcp/src/transports/types.d.ts} +2 -3
  160. package/dist/packages/mcp/src/transports/types.js +1 -0
  161. package/dist/packages/mcp/src/types.d.ts +89 -0
  162. package/dist/packages/mcp/src/types.js +7 -0
  163. package/dist/packages/normalizer/src/example-indexer.d.ts +5 -0
  164. package/dist/packages/normalizer/src/example-indexer.js +200 -0
  165. package/dist/packages/normalizer/src/html.d.ts +13 -0
  166. package/dist/packages/normalizer/src/html.js +221 -0
  167. package/{packages/normalizer/src/index.ts → dist/packages/normalizer/src/index.d.ts} +0 -1
  168. package/dist/packages/normalizer/src/index.js +7 -0
  169. package/dist/packages/normalizer/src/llms.d.ts +3 -0
  170. package/dist/packages/normalizer/src/llms.js +71 -0
  171. package/dist/packages/normalizer/src/openapi/endpoint-parser.d.ts +11 -0
  172. package/dist/packages/normalizer/src/openapi/endpoint-parser.js +357 -0
  173. package/dist/packages/normalizer/src/openapi/schema-resolver.d.ts +10 -0
  174. package/dist/packages/normalizer/src/openapi/schema-resolver.js +82 -0
  175. package/dist/packages/normalizer/src/openapi.js +2 -0
  176. package/dist/packages/normalizer/src/page.d.ts +13 -0
  177. package/dist/packages/normalizer/src/page.js +150 -0
  178. package/dist/packages/normalizer/src/pitfall-extractor.d.ts +6 -0
  179. package/dist/packages/normalizer/src/pitfall-extractor.js +153 -0
  180. package/dist/packages/normalizer/src/slicer.d.ts +30 -0
  181. package/dist/packages/normalizer/src/slicer.js +360 -0
  182. package/dist/packages/retrieval/src/engine.d.ts +17 -0
  183. package/dist/packages/retrieval/src/engine.js +93 -0
  184. package/{packages/retrieval/src/index.ts → dist/packages/retrieval/src/index.d.ts} +0 -1
  185. package/dist/packages/retrieval/src/index.js +6 -0
  186. package/dist/packages/retrieval/src/intent.d.ts +6 -0
  187. package/dist/packages/retrieval/src/intent.js +39 -0
  188. package/dist/packages/retrieval/src/packer.d.ts +2 -0
  189. package/dist/packages/retrieval/src/packer.js +108 -0
  190. package/dist/packages/retrieval/src/recipe-engine.d.ts +18 -0
  191. package/dist/packages/retrieval/src/recipe-engine.js +265 -0
  192. package/dist/packages/retrieval/src/scorer.d.ts +13 -0
  193. package/dist/packages/retrieval/src/scorer.js +110 -0
  194. package/dist/packages/retrieval/src/weights.d.ts +3 -0
  195. package/dist/packages/retrieval/src/weights.js +28 -0
  196. package/dist/packages/security/src/annotations.d.ts +10 -0
  197. package/dist/packages/security/src/annotations.js +100 -0
  198. package/dist/packages/security/src/index.js +2 -0
  199. package/dist/packages/security/src/ssrf.d.ts +17 -0
  200. package/dist/packages/security/src/ssrf.js +132 -0
  201. package/dist/packages/shared/src/errors.d.ts +22 -0
  202. package/dist/packages/shared/src/errors.js +44 -0
  203. package/dist/packages/shared/src/hashing.d.ts +3 -0
  204. package/dist/packages/shared/src/hashing.js +21 -0
  205. package/dist/packages/shared/src/index.js +3 -0
  206. package/dist/packages/shared/src/types.d.ts +715 -0
  207. package/dist/packages/shared/src/types.js +1 -0
  208. package/dist/packages/storage/src/db.d.ts +10 -0
  209. package/dist/packages/storage/src/db.js +61 -0
  210. package/dist/packages/storage/src/index.js +10 -0
  211. package/dist/packages/storage/src/interfaces.d.ts +83 -0
  212. package/dist/packages/storage/src/interfaces.js +1 -0
  213. package/dist/packages/storage/src/repositories/api-repository.d.ts +16 -0
  214. package/dist/packages/storage/src/repositories/api-repository.js +169 -0
  215. package/dist/packages/storage/src/repositories/chunk-repository.d.ts +32 -0
  216. package/dist/packages/storage/src/repositories/chunk-repository.js +250 -0
  217. package/dist/packages/storage/src/repositories/example-repository.d.ts +16 -0
  218. package/dist/packages/storage/src/repositories/example-repository.js +158 -0
  219. package/dist/packages/storage/src/repositories/page-repository.d.ts +16 -0
  220. package/dist/packages/storage/src/repositories/page-repository.js +161 -0
  221. package/dist/packages/storage/src/repositories/pitfall-repository.d.ts +15 -0
  222. package/dist/packages/storage/src/repositories/pitfall-repository.js +144 -0
  223. package/dist/packages/storage/src/repositories/source-repository.d.ts +33 -0
  224. package/dist/packages/storage/src/repositories/source-repository.js +153 -0
  225. package/dist/packages/storage/src/repository.d.ts +92 -0
  226. package/dist/packages/storage/src/repository.js +157 -0
  227. package/dist/packages/storage/src/schema.d.ts +2 -0
  228. package/{packages/storage/src/schema.ts → dist/packages/storage/src/schema.js} +0 -3
  229. package/dist/packages/storage/src/search-tokens.d.ts +6 -0
  230. package/dist/packages/storage/src/search-tokens.js +26 -0
  231. package/dist/packages/verification/src/diff-engine.d.ts +18 -0
  232. package/dist/packages/verification/src/diff-engine.js +218 -0
  233. package/dist/packages/verification/src/extractor.d.ts +29 -0
  234. package/dist/packages/verification/src/extractor.js +302 -0
  235. package/dist/packages/verification/src/impact-scanner.d.ts +9 -0
  236. package/dist/packages/verification/src/impact-scanner.js +181 -0
  237. package/dist/packages/verification/src/index.js +5 -0
  238. package/dist/packages/verification/src/services.d.ts +55 -0
  239. package/dist/packages/verification/src/services.js +189 -0
  240. package/dist/packages/verification/src/verifier.d.ts +15 -0
  241. package/dist/packages/verification/src/verifier.js +315 -0
  242. package/dist/packages/workspace/src/detector.d.ts +7 -0
  243. package/dist/packages/workspace/src/detector.js +117 -0
  244. package/dist/packages/workspace/src/ecosystems/cargo.d.ts +10 -0
  245. package/dist/packages/workspace/src/ecosystems/cargo.js +69 -0
  246. package/dist/packages/workspace/src/ecosystems/composer.d.ts +7 -0
  247. package/dist/packages/workspace/src/ecosystems/composer.js +40 -0
  248. package/dist/packages/workspace/src/ecosystems/go.d.ts +7 -0
  249. package/dist/packages/workspace/src/ecosystems/go.js +49 -0
  250. package/{packages/workspace/src/ecosystems/index.ts → dist/packages/workspace/src/ecosystems/index.d.ts} +2 -24
  251. package/dist/packages/workspace/src/ecosystems/index.js +21 -0
  252. package/dist/packages/workspace/src/ecosystems/maven.d.ts +7 -0
  253. package/dist/packages/workspace/src/ecosystems/maven.js +28 -0
  254. package/dist/packages/workspace/src/ecosystems/npm.d.ts +10 -0
  255. package/dist/packages/workspace/src/ecosystems/npm.js +73 -0
  256. package/dist/packages/workspace/src/ecosystems/pub.d.ts +7 -0
  257. package/dist/packages/workspace/src/ecosystems/pub.js +34 -0
  258. package/dist/packages/workspace/src/ecosystems/pypi.d.ts +9 -0
  259. package/dist/packages/workspace/src/ecosystems/pypi.js +94 -0
  260. package/dist/packages/workspace/src/ecosystems/rubygems.d.ts +7 -0
  261. package/dist/packages/workspace/src/ecosystems/rubygems.js +25 -0
  262. package/dist/packages/workspace/src/ecosystems/types.d.ts +9 -0
  263. package/dist/packages/workspace/src/ecosystems/types.js +1 -0
  264. package/dist/packages/workspace/src/index.js +5 -0
  265. package/dist/packages/workspace/src/lockfile.d.ts +21 -0
  266. package/dist/packages/workspace/src/lockfile.js +153 -0
  267. package/dist/packages/workspace/src/resolver.d.ts +39 -0
  268. package/dist/packages/workspace/src/resolver.js +164 -0
  269. package/dist/packages/workspace/src/semver.d.ts +33 -0
  270. package/dist/packages/workspace/src/semver.js +235 -0
  271. package/package.json +8 -7
  272. package/apps/cli/bin/docorbit.js +0 -8
  273. package/apps/cli/src/commands/add.ts +0 -44
  274. package/apps/cli/src/commands/api.ts +0 -38
  275. package/apps/cli/src/commands/context.ts +0 -47
  276. package/apps/cli/src/commands/dashboard.ts +0 -55
  277. package/apps/cli/src/commands/diff.ts +0 -30
  278. package/apps/cli/src/commands/evaluate.ts +0 -133
  279. package/apps/cli/src/commands/examples.ts +0 -39
  280. package/apps/cli/src/commands/export.ts +0 -89
  281. package/apps/cli/src/commands/impact.ts +0 -31
  282. package/apps/cli/src/commands/init.ts +0 -69
  283. package/apps/cli/src/commands/inspect.ts +0 -30
  284. package/apps/cli/src/commands/mcp.ts +0 -72
  285. package/apps/cli/src/commands/pitfalls.ts +0 -38
  286. package/apps/cli/src/commands/recipes.ts +0 -35
  287. package/apps/cli/src/commands/search.ts +0 -48
  288. package/apps/cli/src/commands/update.ts +0 -73
  289. package/apps/cli/src/commands/verify.ts +0 -48
  290. package/apps/cli/src/formatters/colors.ts +0 -23
  291. package/apps/cli/src/formatters/inspection.ts +0 -102
  292. package/apps/cli/src/formatters/knowledge.ts +0 -272
  293. package/apps/cli/src/formatters/retrieval.ts +0 -74
  294. package/apps/cli/src/formatters/verification.ts +0 -126
  295. package/apps/cli/src/index.ts +0 -409
  296. package/packages/core/src/dashboard/server.ts +0 -314
  297. package/packages/core/src/implementation-service.ts +0 -451
  298. package/packages/core/src/inspector.ts +0 -71
  299. package/packages/core/src/pipeline.ts +0 -331
  300. package/packages/crawler/src/config.ts +0 -12
  301. package/packages/crawler/src/fetcher.ts +0 -185
  302. package/packages/discovery/src/index.ts +0 -31
  303. package/packages/discovery/src/provider.ts +0 -47
  304. package/packages/discovery/src/providers/generic.ts +0 -98
  305. package/packages/discovery/src/providers/github.ts +0 -61
  306. package/packages/discovery/src/providers/llms-txt.ts +0 -73
  307. package/packages/discovery/src/providers/markdown.ts +0 -48
  308. package/packages/discovery/src/providers/openapi.ts +0 -91
  309. package/packages/discovery/src/providers/sitemap.ts +0 -62
  310. package/packages/discovery/src/providers/skill.ts +0 -54
  311. package/packages/discovery/src/ranker.ts +0 -123
  312. package/packages/evaluation/src/dataset.ts +0 -963
  313. package/packages/evaluation/src/runner.ts +0 -241
  314. package/packages/evaluation/src/strategies/context7-runner.ts +0 -269
  315. package/packages/evaluation/src/strategies/docorbit-runner.ts +0 -228
  316. package/packages/evaluation/src/strategies/firecrawl-runner.ts +0 -172
  317. package/packages/evaluation/src/strategies/web-search-runner.ts +0 -194
  318. package/packages/evaluation/src/types.ts +0 -34
  319. package/packages/evaluation/src/version-matcher.ts +0 -73
  320. package/packages/export/src/agents-md.ts +0 -200
  321. package/packages/export/src/claude-md.ts +0 -141
  322. package/packages/export/src/docs-map.ts +0 -150
  323. package/packages/export/src/llms-txt.ts +0 -96
  324. package/packages/export/src/service.ts +0 -250
  325. package/packages/export/src/skill-md.ts +0 -128
  326. package/packages/mcp/src/resources/index.ts +0 -189
  327. package/packages/mcp/src/server.ts +0 -278
  328. package/packages/mcp/src/tools/analyze-impact.ts +0 -74
  329. package/packages/mcp/src/tools/check-api.ts +0 -86
  330. package/packages/mcp/src/tools/diff-docs.ts +0 -68
  331. package/packages/mcp/src/tools/export-context.ts +0 -73
  332. package/packages/mcp/src/tools/find-api.ts +0 -99
  333. package/packages/mcp/src/tools/find-example.ts +0 -100
  334. package/packages/mcp/src/tools/find-pitfall.ts +0 -94
  335. package/packages/mcp/src/tools/find-recipe.ts +0 -98
  336. package/packages/mcp/src/tools/get-doc.ts +0 -130
  337. package/packages/mcp/src/tools/get-docs-map.ts +0 -64
  338. package/packages/mcp/src/tools/get-version.ts +0 -118
  339. package/packages/mcp/src/tools/implementation-context.ts +0 -88
  340. package/packages/mcp/src/tools/index.ts +0 -59
  341. package/packages/mcp/src/tools/list-sources.ts +0 -85
  342. package/packages/mcp/src/tools/search-docs.ts +0 -123
  343. package/packages/mcp/src/tools/types.ts +0 -28
  344. package/packages/mcp/src/transports/http.ts +0 -256
  345. package/packages/mcp/src/transports/stdio.ts +0 -105
  346. package/packages/mcp/src/types.ts +0 -102
  347. package/packages/normalizer/src/example-indexer.ts +0 -240
  348. package/packages/normalizer/src/html.ts +0 -253
  349. package/packages/normalizer/src/llms.ts +0 -83
  350. package/packages/normalizer/src/openapi/endpoint-parser.ts +0 -406
  351. package/packages/normalizer/src/openapi/schema-resolver.ts +0 -111
  352. package/packages/normalizer/src/page.ts +0 -184
  353. package/packages/normalizer/src/pitfall-extractor.ts +0 -190
  354. package/packages/normalizer/src/slicer.ts +0 -455
  355. package/packages/retrieval/src/engine.ts +0 -120
  356. package/packages/retrieval/src/intent.ts +0 -43
  357. package/packages/retrieval/src/packer.ts +0 -145
  358. package/packages/retrieval/src/recipe-engine.ts +0 -313
  359. package/packages/retrieval/src/scorer.ts +0 -139
  360. package/packages/retrieval/src/weights.ts +0 -31
  361. package/packages/security/src/annotations.ts +0 -112
  362. package/packages/security/src/ssrf.ts +0 -153
  363. package/packages/shared/src/errors.ts +0 -53
  364. package/packages/shared/src/hashing.ts +0 -23
  365. package/packages/shared/src/types.ts +0 -881
  366. package/packages/storage/src/db.ts +0 -72
  367. package/packages/storage/src/interfaces.ts +0 -115
  368. package/packages/storage/src/repositories/api-repository.ts +0 -219
  369. package/packages/storage/src/repositories/chunk-repository.ts +0 -316
  370. package/packages/storage/src/repositories/example-repository.ts +0 -206
  371. package/packages/storage/src/repositories/page-repository.ts +0 -205
  372. package/packages/storage/src/repositories/pitfall-repository.ts +0 -188
  373. package/packages/storage/src/repositories/source-repository.ts +0 -205
  374. package/packages/storage/src/repository.ts +0 -256
  375. package/packages/storage/src/search-tokens.ts +0 -28
  376. package/packages/verification/src/diff-engine.ts +0 -258
  377. package/packages/verification/src/extractor.ts +0 -339
  378. package/packages/verification/src/impact-scanner.ts +0 -203
  379. package/packages/verification/src/services.ts +0 -238
  380. package/packages/verification/src/verifier.ts +0 -375
  381. package/packages/workspace/src/detector.ts +0 -143
  382. package/packages/workspace/src/ecosystems/cargo.ts +0 -84
  383. package/packages/workspace/src/ecosystems/composer.ts +0 -42
  384. package/packages/workspace/src/ecosystems/go.ts +0 -54
  385. package/packages/workspace/src/ecosystems/maven.ts +0 -34
  386. package/packages/workspace/src/ecosystems/npm.ts +0 -83
  387. package/packages/workspace/src/ecosystems/pub.ts +0 -40
  388. package/packages/workspace/src/ecosystems/pypi.ts +0 -100
  389. package/packages/workspace/src/ecosystems/rubygems.ts +0 -30
  390. package/packages/workspace/src/ecosystems/types.ts +0 -18
  391. package/packages/workspace/src/lockfile.ts +0 -194
  392. package/packages/workspace/src/resolver.ts +0 -234
  393. package/packages/workspace/src/semver.ts +0 -259
  394. /package/{packages/crawler/src/index.ts → dist/packages/crawler/src/index.d.ts} +0 -0
  395. /package/{packages/evaluation/src/index.ts → dist/packages/evaluation/src/index.d.ts} +0 -0
  396. /package/{packages/export/src/index.ts → dist/packages/export/src/index.d.ts} +0 -0
  397. /package/{packages/normalizer/src/openapi.ts → dist/packages/normalizer/src/openapi.d.ts} +0 -0
  398. /package/{packages/security/src/index.ts → dist/packages/security/src/index.d.ts} +0 -0
  399. /package/{packages/shared/src/index.ts → dist/packages/shared/src/index.d.ts} +0 -0
  400. /package/{packages/storage/src/index.ts → dist/packages/storage/src/index.d.ts} +0 -0
  401. /package/{packages/verification/src/index.ts → dist/packages/verification/src/index.d.ts} +0 -0
  402. /package/{packages/workspace/src/index.ts → dist/packages/workspace/src/index.d.ts} +0 -0
@@ -0,0 +1,92 @@
1
+ import type { DiscoveredSource, NormalizedPage, DocumentChunk, ChunkCode, SymbolReference, ChunkRelationship, ChunkType, ApiEndpoint, IndexedExample, Pitfall, PitfallKind } from '../../shared/src/index.ts';
2
+ import type { DocOrbitDb } from './db.ts';
3
+ import type { Snapshot, ISourceRepository, IPageRepository, IChunkRepository, IApiRepository, IExampleRepository, IPitfallRepository } from './interfaces.ts';
4
+ import { SourceRepository } from './repositories/source-repository.ts';
5
+ import { PageRepository } from './repositories/page-repository.ts';
6
+ import { ChunkRepository } from './repositories/chunk-repository.ts';
7
+ import { ApiRepository } from './repositories/api-repository.ts';
8
+ import { ExampleRepository } from './repositories/example-repository.ts';
9
+ import { PitfallRepository } from './repositories/pitfall-repository.ts';
10
+ export type { Snapshot } from './interfaces.ts';
11
+ /**
12
+ * Unified Facade for the DocOrbit database storage layer.
13
+ * Delegates domain responsibilities to specialized sub-repositories:
14
+ * - sources: ISourceRepository (sources, snapshots, snapshot-page links)
15
+ * - pages: IPageRepository (normalized pages, page links, page FTS)
16
+ * - chunks: IChunkRepository (document chunks, code, symbols, relationships, chunk FTS)
17
+ * - apis: IApiRepository (API endpoints, OpenAPI schemas, endpoint FTS)
18
+ * - examples: IExampleRepository (code examples, example FTS)
19
+ * - pitfalls: IPitfallRepository (pitfalls, gotchas, pitfall FTS)
20
+ */
21
+ export declare class DocOrbitRepository implements ISourceRepository, IPageRepository, IChunkRepository, IApiRepository, IExampleRepository, IPitfallRepository {
22
+ readonly sources: SourceRepository;
23
+ readonly pages: PageRepository;
24
+ readonly chunks: ChunkRepository;
25
+ readonly apis: ApiRepository;
26
+ readonly examples: ExampleRepository;
27
+ readonly pitfalls: PitfallRepository;
28
+ readonly db: DocOrbitDb;
29
+ constructor(db: DocOrbitDb);
30
+ saveSource(source: DiscoveredSource): string;
31
+ getSource(id: string): DiscoveredSource | null;
32
+ getSourceByUrl(url: string): DiscoveredSource | null;
33
+ listSources(): DiscoveredSource[];
34
+ createSnapshot(sourceId: string, metadata?: Record<string, unknown>, docVersion?: string): string;
35
+ saveSnapshot(snapshot: Snapshot): void;
36
+ getSnapshot(id: string): Snapshot | null;
37
+ getLatestSnapshot(sourceId: string): Snapshot | null;
38
+ listSnapshots(sourceId: string): Snapshot[];
39
+ linkSnapshotPages(snapshotId: string, pageIds: string[]): void;
40
+ getSnapshotPages(snapshotId: string): NormalizedPage[];
41
+ savePage(page: NormalizedPage): void;
42
+ getPage(id: string): NormalizedPage | null;
43
+ getPageByUrl(normalizedUrl: string): NormalizedPage | null;
44
+ listPages(limit?: number, offset?: number): NormalizedPage[];
45
+ countPages(sourceId?: string): number;
46
+ savePageLinks(pageId: string, targetUrls: string[]): void;
47
+ getPageLinks(pageId: string): string[];
48
+ searchPagesFts(query: string, limit?: number): NormalizedPage[];
49
+ saveChunks(chunks: DocumentChunk[], relationships?: ChunkRelationship[], codeSnippets?: ChunkCode[], symbols?: SymbolReference[]): void;
50
+ getChunk(id: string): DocumentChunk | null;
51
+ getChunksByPage(pageId: string): DocumentChunk[];
52
+ getChunksBySnapshot(snapshotId: string): DocumentChunk[];
53
+ getChunksByVersion(docVersion: string): DocumentChunk[];
54
+ getChunkCode(chunkId: string): ChunkCode[];
55
+ getChunkSymbols(chunkId: string): SymbolReference[];
56
+ getChunkRelationships(chunkId: string): ChunkRelationship[];
57
+ countChunks(snapshotId?: string): number;
58
+ searchChunksFts(query: string, options?: {
59
+ limit?: number;
60
+ snapshotId?: string;
61
+ chunkType?: ChunkType;
62
+ docVersion?: string;
63
+ }): Array<{
64
+ chunk: DocumentChunk;
65
+ ftsRank: number;
66
+ symbols: SymbolReference[];
67
+ codeSnippets: ChunkCode[];
68
+ }>;
69
+ saveApiEndpoints(endpoints: ApiEndpoint[]): void;
70
+ getApiEndpoint(id: string): ApiEndpoint | null;
71
+ getApiEndpointsBySnapshot(snapshotId: string): ApiEndpoint[];
72
+ searchApiEndpoints(query: string, options?: {
73
+ method?: string;
74
+ docVersion?: string;
75
+ limit?: number;
76
+ }): ApiEndpoint[];
77
+ saveIndexedExamples(examples: IndexedExample[]): void;
78
+ getIndexedExamplesBySnapshot(snapshotId: string): IndexedExample[];
79
+ searchIndexedExamples(query: string, options?: {
80
+ language?: string;
81
+ framework?: string;
82
+ docVersion?: string;
83
+ limit?: number;
84
+ }): IndexedExample[];
85
+ savePitfalls(pitfalls: Pitfall[]): void;
86
+ getPitfallsBySnapshot(snapshotId: string): Pitfall[];
87
+ searchPitfalls(query: string, options?: {
88
+ kind?: PitfallKind;
89
+ docVersion?: string;
90
+ limit?: number;
91
+ }): Pitfall[];
92
+ }
@@ -0,0 +1,157 @@
1
+ import { SourceRepository } from "./repositories/source-repository.js";
2
+ import { PageRepository } from "./repositories/page-repository.js";
3
+ import { ChunkRepository } from "./repositories/chunk-repository.js";
4
+ import { ApiRepository } from "./repositories/api-repository.js";
5
+ import { ExampleRepository } from "./repositories/example-repository.js";
6
+ import { PitfallRepository } from "./repositories/pitfall-repository.js";
7
+ /**
8
+ * Unified Facade for the DocOrbit database storage layer.
9
+ * Delegates domain responsibilities to specialized sub-repositories:
10
+ * - sources: ISourceRepository (sources, snapshots, snapshot-page links)
11
+ * - pages: IPageRepository (normalized pages, page links, page FTS)
12
+ * - chunks: IChunkRepository (document chunks, code, symbols, relationships, chunk FTS)
13
+ * - apis: IApiRepository (API endpoints, OpenAPI schemas, endpoint FTS)
14
+ * - examples: IExampleRepository (code examples, example FTS)
15
+ * - pitfalls: IPitfallRepository (pitfalls, gotchas, pitfall FTS)
16
+ */
17
+ export class DocOrbitRepository {
18
+ sources;
19
+ pages;
20
+ chunks;
21
+ apis;
22
+ examples;
23
+ pitfalls;
24
+ db;
25
+ constructor(db) {
26
+ this.db = db;
27
+ this.pages = new PageRepository(db);
28
+ this.sources = new SourceRepository(db, row => this.pages.hydratePage(row));
29
+ this.chunks = new ChunkRepository(db);
30
+ this.apis = new ApiRepository(db);
31
+ this.examples = new ExampleRepository(db);
32
+ this.pitfalls = new PitfallRepository(db);
33
+ }
34
+ // --- ISourceRepository Delegations ---
35
+ saveSource(source) {
36
+ return this.sources.saveSource(source);
37
+ }
38
+ getSource(id) {
39
+ return this.sources.getSource(id);
40
+ }
41
+ getSourceByUrl(url) {
42
+ return this.sources.getSourceByUrl(url);
43
+ }
44
+ listSources() {
45
+ return this.sources.listSources();
46
+ }
47
+ createSnapshot(sourceId, metadata, docVersion) {
48
+ return this.sources.createSnapshot(sourceId, metadata, docVersion);
49
+ }
50
+ saveSnapshot(snapshot) {
51
+ this.sources.saveSnapshot(snapshot);
52
+ }
53
+ getSnapshot(id) {
54
+ return this.sources.getSnapshot(id);
55
+ }
56
+ getLatestSnapshot(sourceId) {
57
+ return this.sources.getLatestSnapshot(sourceId);
58
+ }
59
+ listSnapshots(sourceId) {
60
+ return this.sources.listSnapshots(sourceId);
61
+ }
62
+ linkSnapshotPages(snapshotId, pageIds) {
63
+ this.sources.linkSnapshotPages(snapshotId, pageIds);
64
+ }
65
+ getSnapshotPages(snapshotId) {
66
+ return this.sources.getSnapshotPages(snapshotId);
67
+ }
68
+ // --- IPageRepository Delegations ---
69
+ savePage(page) {
70
+ this.pages.savePage(page);
71
+ }
72
+ getPage(id) {
73
+ return this.pages.getPage(id);
74
+ }
75
+ getPageByUrl(normalizedUrl) {
76
+ return this.pages.getPageByUrl(normalizedUrl);
77
+ }
78
+ listPages(limit, offset) {
79
+ return this.pages.listPages(limit, offset);
80
+ }
81
+ countPages(sourceId) {
82
+ return this.pages.countPages(sourceId);
83
+ }
84
+ savePageLinks(pageId, targetUrls) {
85
+ this.pages.savePageLinks(pageId, targetUrls);
86
+ }
87
+ getPageLinks(pageId) {
88
+ return this.pages.getPageLinks(pageId);
89
+ }
90
+ searchPagesFts(query, limit = 10) {
91
+ return this.pages.searchPagesFts(query, limit);
92
+ }
93
+ // --- IChunkRepository Delegations ---
94
+ saveChunks(chunks, relationships = [], codeSnippets = [], symbols = []) {
95
+ this.chunks.saveChunks(chunks, relationships, codeSnippets, symbols);
96
+ }
97
+ getChunk(id) {
98
+ return this.chunks.getChunk(id);
99
+ }
100
+ getChunksByPage(pageId) {
101
+ return this.chunks.getChunksByPage(pageId);
102
+ }
103
+ getChunksBySnapshot(snapshotId) {
104
+ return this.chunks.getChunksBySnapshot(snapshotId);
105
+ }
106
+ getChunksByVersion(docVersion) {
107
+ return this.chunks.getChunksByVersion(docVersion);
108
+ }
109
+ getChunkCode(chunkId) {
110
+ return this.chunks.getChunkCode(chunkId);
111
+ }
112
+ getChunkSymbols(chunkId) {
113
+ return this.chunks.getChunkSymbols(chunkId);
114
+ }
115
+ getChunkRelationships(chunkId) {
116
+ return this.chunks.getChunkRelationships(chunkId);
117
+ }
118
+ countChunks(snapshotId) {
119
+ return this.chunks.countChunks(snapshotId);
120
+ }
121
+ searchChunksFts(query, options = {}) {
122
+ return this.chunks.searchChunksFts(query, options);
123
+ }
124
+ // --- IApiRepository Delegations ---
125
+ saveApiEndpoints(endpoints) {
126
+ this.apis.saveApiEndpoints(endpoints);
127
+ }
128
+ getApiEndpoint(id) {
129
+ return this.apis.getApiEndpoint(id);
130
+ }
131
+ getApiEndpointsBySnapshot(snapshotId) {
132
+ return this.apis.getApiEndpointsBySnapshot(snapshotId);
133
+ }
134
+ searchApiEndpoints(query, options = {}) {
135
+ return this.apis.searchApiEndpoints(query, options);
136
+ }
137
+ // --- IExampleRepository Delegations ---
138
+ saveIndexedExamples(examples) {
139
+ this.examples.saveIndexedExamples(examples);
140
+ }
141
+ getIndexedExamplesBySnapshot(snapshotId) {
142
+ return this.examples.getIndexedExamplesBySnapshot(snapshotId);
143
+ }
144
+ searchIndexedExamples(query, options = {}) {
145
+ return this.examples.searchIndexedExamples(query, options);
146
+ }
147
+ // --- IPitfallRepository Delegations ---
148
+ savePitfalls(pitfalls) {
149
+ this.pitfalls.savePitfalls(pitfalls);
150
+ }
151
+ getPitfallsBySnapshot(snapshotId) {
152
+ return this.pitfalls.getPitfallsBySnapshot(snapshotId);
153
+ }
154
+ searchPitfalls(query, options = {}) {
155
+ return this.pitfalls.searchPitfalls(query, options);
156
+ }
157
+ }
@@ -0,0 +1,2 @@
1
+ export declare const SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS sources (\n id TEXT PRIMARY KEY,\n url TEXT UNIQUE NOT NULL,\n type TEXT NOT NULL,\n discovered_by TEXT NOT NULL,\n status TEXT NOT NULL,\n content_type TEXT,\n confidence REAL NOT NULL,\n authority TEXT NOT NULL,\n machine_readable INTEGER NOT NULL,\n metadata TEXT,\n created_at TEXT NOT NULL\n);\n\nCREATE TABLE IF NOT EXISTS pages (\n id TEXT PRIMARY KEY,\n source_id TEXT NOT NULL,\n title TEXT NOT NULL,\n url TEXT UNIQUE NOT NULL,\n content TEXT NOT NULL,\n content_hash TEXT NOT NULL,\n fetched_at TEXT NOT NULL,\n raw_bytes INTEGER NOT NULL,\n estimated_tokens INTEGER NOT NULL,\n headings_json TEXT,\n security_annotations_json TEXT,\n provenance_json TEXT,\n FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE\n);\n\nCREATE TABLE IF NOT EXISTS links (\n id TEXT PRIMARY KEY,\n page_id TEXT NOT NULL,\n text TEXT NOT NULL,\n url TEXT NOT NULL,\n is_external INTEGER NOT NULL,\n FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE\n);\n\nCREATE TABLE IF NOT EXISTS code_examples (\n id TEXT PRIMARY KEY,\n page_id TEXT NOT NULL,\n language TEXT NOT NULL,\n code TEXT NOT NULL,\n caption TEXT,\n FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE\n);\n\nCREATE TABLE IF NOT EXISTS snapshots (\n id TEXT PRIMARY KEY,\n source_id TEXT NOT NULL,\n snapshot_hash TEXT NOT NULL,\n page_count INTEGER NOT NULL,\n captured_at TEXT NOT NULL,\n doc_version TEXT,\n metadata TEXT,\n FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE\n);\n\nCREATE TABLE IF NOT EXISTS snapshot_pages (\n snapshot_id TEXT NOT NULL,\n page_id TEXT NOT NULL,\n content_hash TEXT NOT NULL,\n PRIMARY KEY (snapshot_id, page_id),\n FOREIGN KEY (snapshot_id) REFERENCES snapshots(id) ON DELETE CASCADE,\n FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE\n);\n\nCREATE TABLE IF NOT EXISTS chunks (\n id TEXT PRIMARY KEY,\n page_id TEXT NOT NULL,\n snapshot_id TEXT NOT NULL,\n title TEXT,\n section_path_json TEXT NOT NULL,\n content TEXT NOT NULL,\n chunk_type TEXT NOT NULL,\n language TEXT,\n token_estimate INTEGER NOT NULL,\n ordinal INTEGER NOT NULL,\n content_hash TEXT NOT NULL,\n doc_version TEXT,\n provenance_json TEXT,\n created_at TEXT NOT NULL,\n FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE\n);\n\nCREATE TABLE IF NOT EXISTS chunk_code (\n id TEXT PRIMARY KEY,\n chunk_id TEXT NOT NULL,\n language TEXT,\n code TEXT NOT NULL,\n FOREIGN KEY (chunk_id) REFERENCES chunks(id) ON DELETE CASCADE\n);\n\nCREATE TABLE IF NOT EXISTS symbol_references (\n id TEXT PRIMARY KEY,\n chunk_id TEXT NOT NULL,\n name TEXT NOT NULL,\n kind TEXT NOT NULL,\n FOREIGN KEY (chunk_id) REFERENCES chunks(id) ON DELETE CASCADE\n);\n\nCREATE TABLE IF NOT EXISTS chunk_relationships (\n source_chunk_id TEXT NOT NULL,\n target_chunk_id TEXT NOT NULL,\n type TEXT NOT NULL,\n PRIMARY KEY (source_chunk_id, target_chunk_id, type)\n);\n\nCREATE INDEX IF NOT EXISTS idx_pages_source_id ON pages(source_id);\nCREATE INDEX IF NOT EXISTS idx_pages_content_hash ON pages(content_hash);\nCREATE INDEX IF NOT EXISTS idx_links_page_id ON links(page_id);\nCREATE INDEX IF NOT EXISTS idx_code_examples_page_id ON code_examples(page_id);\nCREATE INDEX IF NOT EXISTS idx_snapshots_source_id ON snapshots(source_id);\nCREATE INDEX IF NOT EXISTS idx_snapshots_doc_version ON snapshots(doc_version);\nCREATE INDEX IF NOT EXISTS idx_snapshot_pages_snapshot_id ON snapshot_pages(snapshot_id);\nCREATE INDEX IF NOT EXISTS idx_snapshot_pages_page_id ON snapshot_pages(page_id);\nCREATE INDEX IF NOT EXISTS idx_chunks_page_id ON chunks(page_id);\nCREATE INDEX IF NOT EXISTS idx_chunks_snapshot_id ON chunks(snapshot_id);\nCREATE INDEX IF NOT EXISTS idx_chunks_chunk_type ON chunks(chunk_type);\nCREATE INDEX IF NOT EXISTS idx_chunks_content_hash ON chunks(content_hash);\nCREATE INDEX IF NOT EXISTS idx_chunks_doc_version ON chunks(doc_version);\nCREATE INDEX IF NOT EXISTS idx_chunk_code_chunk_id ON chunk_code(chunk_id);\nCREATE INDEX IF NOT EXISTS idx_symbol_references_chunk_id ON symbol_references(chunk_id);\nCREATE INDEX IF NOT EXISTS idx_symbol_references_name ON symbol_references(name);\nCREATE INDEX IF NOT EXISTS idx_chunk_relationships_source ON chunk_relationships(source_chunk_id);\nCREATE INDEX IF NOT EXISTS idx_chunk_relationships_target ON chunk_relationships(target_chunk_id);\n\nCREATE TABLE IF NOT EXISTS api_endpoints (\n id TEXT PRIMARY KEY,\n page_id TEXT NOT NULL,\n snapshot_id TEXT NOT NULL,\n method TEXT NOT NULL,\n path TEXT NOT NULL,\n summary TEXT,\n description TEXT,\n operation_id TEXT,\n parameters_json TEXT NOT NULL,\n request_schema_json TEXT,\n response_schema_json TEXT,\n auth_json TEXT NOT NULL,\n errors_json TEXT NOT NULL,\n pagination_json TEXT,\n deprecated INTEGER NOT NULL,\n doc_version TEXT,\n provenance_json TEXT,\n created_at TEXT NOT NULL,\n FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE\n);\n\nCREATE INDEX IF NOT EXISTS idx_api_endpoints_page_id ON api_endpoints(page_id);\nCREATE INDEX IF NOT EXISTS idx_api_endpoints_snapshot_id ON api_endpoints(snapshot_id);\nCREATE INDEX IF NOT EXISTS idx_api_endpoints_method ON api_endpoints(method);\nCREATE INDEX IF NOT EXISTS idx_api_endpoints_path ON api_endpoints(path);\nCREATE INDEX IF NOT EXISTS idx_api_endpoints_doc_version ON api_endpoints(doc_version);\n\nCREATE TABLE IF NOT EXISTS indexed_examples (\n id TEXT PRIMARY KEY,\n chunk_id TEXT,\n page_id TEXT NOT NULL,\n snapshot_id TEXT NOT NULL,\n language TEXT NOT NULL,\n framework TEXT,\n task TEXT NOT NULL,\n code TEXT NOT NULL,\n source_url TEXT NOT NULL,\n source_authority TEXT NOT NULL,\n related_api TEXT,\n related_symbol TEXT,\n doc_version TEXT,\n provenance_json TEXT,\n created_at TEXT NOT NULL,\n FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE\n);\n\nCREATE INDEX IF NOT EXISTS idx_indexed_examples_page_id ON indexed_examples(page_id);\nCREATE INDEX IF NOT EXISTS idx_indexed_examples_snapshot_id ON indexed_examples(snapshot_id);\nCREATE INDEX IF NOT EXISTS idx_indexed_examples_chunk_id ON indexed_examples(chunk_id);\nCREATE INDEX IF NOT EXISTS idx_indexed_examples_language ON indexed_examples(language);\nCREATE INDEX IF NOT EXISTS idx_indexed_examples_framework ON indexed_examples(framework);\nCREATE INDEX IF NOT EXISTS idx_indexed_examples_doc_version ON indexed_examples(doc_version);\nCREATE INDEX IF NOT EXISTS idx_indexed_examples_related_api ON indexed_examples(related_api);\n\nCREATE TABLE IF NOT EXISTS pitfalls (\n id TEXT PRIMARY KEY,\n chunk_id TEXT,\n page_id TEXT NOT NULL,\n snapshot_id TEXT NOT NULL,\n kind TEXT NOT NULL,\n title TEXT NOT NULL,\n content TEXT NOT NULL,\n related_api TEXT,\n related_symbol TEXT,\n doc_version TEXT,\n provenance_json TEXT,\n created_at TEXT NOT NULL,\n FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE\n);\n\nCREATE INDEX IF NOT EXISTS idx_pitfalls_page_id ON pitfalls(page_id);\nCREATE INDEX IF NOT EXISTS idx_pitfalls_snapshot_id ON pitfalls(snapshot_id);\nCREATE INDEX IF NOT EXISTS idx_pitfalls_chunk_id ON pitfalls(chunk_id);\nCREATE INDEX IF NOT EXISTS idx_pitfalls_kind ON pitfalls(kind);\nCREATE INDEX IF NOT EXISTS idx_pitfalls_doc_version ON pitfalls(doc_version);\nCREATE INDEX IF NOT EXISTS idx_pitfalls_related_api ON pitfalls(related_api);\n";
2
+ export declare const FTS_SCHEMA_SQL = "\nCREATE VIRTUAL TABLE IF NOT EXISTS pages_fts USING fts5(\n page_id UNINDEXED,\n title,\n content\n);\n\nCREATE VIRTUAL TABLE IF NOT EXISTS chunks_fts USING fts5(\n chunk_id UNINDEXED,\n title,\n section_path,\n content,\n symbols\n);\n\nCREATE TRIGGER IF NOT EXISTS trg_chunks_delete AFTER DELETE ON chunks BEGIN\n DELETE FROM chunks_fts WHERE chunk_id = old.id;\nEND;\n\nCREATE VIRTUAL TABLE IF NOT EXISTS api_endpoints_fts USING fts5(\n endpoint_id UNINDEXED,\n method,\n path,\n summary,\n description,\n parameters\n);\n\nCREATE TRIGGER IF NOT EXISTS trg_api_endpoints_delete AFTER DELETE ON api_endpoints BEGIN\n DELETE FROM api_endpoints_fts WHERE endpoint_id = old.id;\nEND;\n\nCREATE VIRTUAL TABLE IF NOT EXISTS indexed_examples_fts USING fts5(\n example_id UNINDEXED,\n task,\n language,\n framework,\n code,\n related_api,\n related_symbol\n);\n\nCREATE TRIGGER IF NOT EXISTS trg_indexed_examples_delete AFTER DELETE ON indexed_examples BEGIN\n DELETE FROM indexed_examples_fts WHERE example_id = old.id;\nEND;\n\nCREATE VIRTUAL TABLE IF NOT EXISTS pitfalls_fts USING fts5(\n pitfall_id UNINDEXED,\n kind,\n title,\n content,\n related_api,\n related_symbol\n);\n\nCREATE TRIGGER IF NOT EXISTS trg_pitfalls_delete AFTER DELETE ON pitfalls BEGIN\n DELETE FROM pitfalls_fts WHERE pitfall_id = old.id;\nEND;\n";
@@ -205,7 +205,6 @@ CREATE INDEX IF NOT EXISTS idx_pitfalls_kind ON pitfalls(kind);
205
205
  CREATE INDEX IF NOT EXISTS idx_pitfalls_doc_version ON pitfalls(doc_version);
206
206
  CREATE INDEX IF NOT EXISTS idx_pitfalls_related_api ON pitfalls(related_api);
207
207
  `;
208
-
209
208
  export const FTS_SCHEMA_SQL = `
210
209
  CREATE VIRTUAL TABLE IF NOT EXISTS pages_fts USING fts5(
211
210
  page_id UNINDEXED,
@@ -265,5 +264,3 @@ CREATE TRIGGER IF NOT EXISTS trg_pitfalls_delete AFTER DELETE ON pitfalls BEGIN
265
264
  DELETE FROM pitfalls_fts WHERE pitfall_id = old.id;
266
265
  END;
267
266
  `;
268
-
269
-
@@ -0,0 +1,6 @@
1
+ export declare const SEARCH_STOPWORDS: Set<string>;
2
+ /**
3
+ * Extracts substantive tokens from query text, filtering out common stopwords
4
+ * and short words (< 3 chars), while falling back to short words if query has no substantive words.
5
+ */
6
+ export declare function extractSearchTokens(text: string): string[];
@@ -0,0 +1,26 @@
1
+ export const SEARCH_STOPWORDS = new Set([
2
+ 'a', 'about', 'above', 'after', 'again', 'against', 'all', 'am', 'an', 'and', 'any', 'are',
3
+ 'as', 'at', 'be', 'because', 'been', 'before', 'being', 'below', 'between', 'both', 'but', 'by',
4
+ 'can', 'did', 'do', 'does', 'doing', 'down', 'during', 'each', 'few', 'for', 'from',
5
+ 'further', 'had', 'has', 'have', 'having', 'he', 'her', 'here', 'hers', 'herself', 'him',
6
+ 'himself', 'his', 'how', 'i', 'if', 'in', 'into', 'is', 'it', 'its', 'itself', 'just',
7
+ 'me', 'more', 'most', 'my', 'myself', 'no', 'nor', 'not', 'now', 'of', 'off', 'on',
8
+ 'once', 'only', 'or', 'other', 'our', 'ours', 'ourselves', 'out', 'over', 'own', 'same',
9
+ 'she', 'should', 'so', 'some', 'such', 'than', 'that', 'the', 'their', 'theirs', 'them',
10
+ 'themselves', 'then', 'there', 'these', 'they', 'this', 'those', 'through', 'to', 'too',
11
+ 'under', 'until', 'up', 'very', 'was', 'we', 'were', 'what', 'when', 'where', 'which',
12
+ 'while', 'who', 'whom', 'why', 'with', 'you', 'your', 'yours', 'yourself', 'yourselves'
13
+ ]);
14
+ /**
15
+ * Extracts substantive tokens from query text, filtering out common stopwords
16
+ * and short words (< 3 chars), while falling back to short words if query has no substantive words.
17
+ */
18
+ export function extractSearchTokens(text) {
19
+ const words = text
20
+ .replace(/[^\w\s-]/g, ' ')
21
+ .trim()
22
+ .split(/\s+/)
23
+ .filter(w => w.length > 0);
24
+ const substantive = words.filter(w => w.length >= 3 && !SEARCH_STOPWORDS.has(w.toLowerCase()));
25
+ return substantive.length > 0 ? substantive : words.filter(w => w.length >= 2);
26
+ }
@@ -0,0 +1,18 @@
1
+ import type { DocDiffResult } from '../../shared/src/index.ts';
2
+ import type { DocOrbitRepository } from '../../storage/src/index.ts';
3
+ export interface DiffOptions {
4
+ fromVersion?: string;
5
+ toVersion?: string;
6
+ fromSnapshotId?: string;
7
+ toSnapshotId?: string;
8
+ sourceId?: string;
9
+ }
10
+ export declare class DocDiffEngine {
11
+ private repo;
12
+ constructor(repo: DocOrbitRepository);
13
+ diff(options: DiffOptions): DocDiffResult;
14
+ private getEndpoints;
15
+ private getPitfalls;
16
+ private detectEndpointModifications;
17
+ private computeContentDiffs;
18
+ }
@@ -0,0 +1,218 @@
1
+ export class DocDiffEngine {
2
+ repo;
3
+ constructor(repo) {
4
+ this.repo = repo;
5
+ }
6
+ diff(options) {
7
+ const fromEndpoints = this.getEndpoints(options.fromSnapshotId, options.fromVersion);
8
+ const toEndpoints = this.getEndpoints(options.toSnapshotId, options.toVersion);
9
+ const fromPitfalls = this.getPitfalls(options.fromSnapshotId, options.fromVersion);
10
+ const toPitfalls = this.getPitfalls(options.toSnapshotId, options.toVersion);
11
+ // 1. Compute Endpoint Diffs
12
+ const apiChanges = [];
13
+ const fromMap = new Map();
14
+ const toMap = new Map();
15
+ for (const ep of fromEndpoints) {
16
+ fromMap.set(`${ep.method.toUpperCase()} ${ep.path}`, ep);
17
+ }
18
+ for (const ep of toEndpoints) {
19
+ toMap.set(`${ep.method.toUpperCase()} ${ep.path}`, ep);
20
+ }
21
+ let addedCount = 0;
22
+ let removedCount = 0;
23
+ let modifiedCount = 0;
24
+ let deprecatedCount = 0;
25
+ // Check additions, deprecations, and modifications in 'to'
26
+ for (const [key, toEp] of toMap.entries()) {
27
+ const fromEp = fromMap.get(key);
28
+ if (!fromEp) {
29
+ // Newly added endpoint
30
+ apiChanges.push({
31
+ path: toEp.path,
32
+ method: toEp.method,
33
+ changeType: 'added',
34
+ endpoint: toEp,
35
+ });
36
+ addedCount++;
37
+ }
38
+ else {
39
+ // Existed previously: check deprecation status
40
+ if (toEp.deprecated && !fromEp.deprecated) {
41
+ apiChanges.push({
42
+ path: toEp.path,
43
+ method: toEp.method,
44
+ changeType: 'deprecated',
45
+ endpoint: toEp,
46
+ previousEndpoint: fromEp,
47
+ });
48
+ deprecatedCount++;
49
+ }
50
+ // Check semantic parameter and schema modifications
51
+ const changes = this.detectEndpointModifications(fromEp, toEp);
52
+ if (changes.length > 0) {
53
+ apiChanges.push({
54
+ path: toEp.path,
55
+ method: toEp.method,
56
+ changeType: 'modified',
57
+ changes,
58
+ endpoint: toEp,
59
+ previousEndpoint: fromEp,
60
+ });
61
+ modifiedCount++;
62
+ }
63
+ }
64
+ }
65
+ // Check removals from 'from'
66
+ for (const [key, fromEp] of fromMap.entries()) {
67
+ if (!toMap.has(key)) {
68
+ apiChanges.push({
69
+ path: fromEp.path,
70
+ method: fromEp.method,
71
+ changeType: 'removed',
72
+ endpoint: fromEp,
73
+ });
74
+ removedCount++;
75
+ }
76
+ }
77
+ // 2. Compute Pitfall Diffs
78
+ const pitfallChanges = [];
79
+ const fromPitfallTitles = new Set(fromPitfalls.map(p => `${p.kind}:${p.title}`));
80
+ const toPitfallTitles = new Set(toPitfalls.map(p => `${p.kind}:${p.title}`));
81
+ for (const toP of toPitfalls) {
82
+ if (!fromPitfallTitles.has(`${toP.kind}:${toP.title}`)) {
83
+ pitfallChanges.push({ changeType: 'added', pitfall: toP });
84
+ }
85
+ }
86
+ for (const fromP of fromPitfalls) {
87
+ if (!toPitfallTitles.has(`${fromP.kind}:${fromP.title}`)) {
88
+ pitfallChanges.push({ changeType: 'removed', pitfall: fromP });
89
+ }
90
+ }
91
+ // 3. Compute Content/Chunk Diffs (Semantic only, ignoring formatting-only whitespace)
92
+ const contentChanges = this.computeContentDiffs(options);
93
+ return {
94
+ fromVersion: options.fromVersion,
95
+ toVersion: options.toVersion,
96
+ fromSnapshotId: options.fromSnapshotId,
97
+ toSnapshotId: options.toSnapshotId,
98
+ sourceId: options.sourceId,
99
+ summary: {
100
+ endpointsAdded: addedCount,
101
+ endpointsRemoved: removedCount,
102
+ endpointsModified: modifiedCount,
103
+ endpointsDeprecated: deprecatedCount,
104
+ pitfallsAdded: pitfallChanges.filter(p => p.changeType === 'added').length,
105
+ pitfallsRemoved: pitfallChanges.filter(p => p.changeType === 'removed').length,
106
+ contentChanged: contentChanges.length,
107
+ },
108
+ apiChanges,
109
+ pitfallChanges,
110
+ contentChanges,
111
+ retrievedAt: new Date().toISOString(),
112
+ };
113
+ }
114
+ getEndpoints(snapshotId, docVersion) {
115
+ if (snapshotId) {
116
+ return this.repo.getApiEndpointsBySnapshot(snapshotId);
117
+ }
118
+ return this.repo.searchApiEndpoints('', {
119
+ docVersion,
120
+ limit: 500,
121
+ });
122
+ }
123
+ getPitfalls(snapshotId, docVersion) {
124
+ if (snapshotId) {
125
+ return this.repo.getPitfallsBySnapshot(snapshotId);
126
+ }
127
+ return this.repo.searchPitfalls('', {
128
+ docVersion,
129
+ limit: 200,
130
+ });
131
+ }
132
+ detectEndpointModifications(fromEp, toEp) {
133
+ const changes = [];
134
+ // Compare parameters
135
+ const fromParams = new Map(fromEp.parameters.map(p => [p.name, p]));
136
+ const toParams = new Map(toEp.parameters.map(p => [p.name, p]));
137
+ for (const [name, toP] of toParams.entries()) {
138
+ const fromP = fromParams.get(name);
139
+ if (!fromP) {
140
+ changes.push(`Added parameter "${name}"${toP.required ? ' (required)' : ''}`);
141
+ }
142
+ else if (!fromP.required && toP.required) {
143
+ changes.push(`Parameter "${name}" is now required (was optional)`);
144
+ }
145
+ else if (fromP.type !== toP.type && toP.type) {
146
+ changes.push(`Parameter "${name}" type changed from ${fromP.type || 'any'} to ${toP.type}`);
147
+ }
148
+ }
149
+ for (const name of fromParams.keys()) {
150
+ if (!toParams.has(name)) {
151
+ changes.push(`Removed parameter "${name}"`);
152
+ }
153
+ }
154
+ // Compare Request Body required fields
155
+ const fromReq = new Set(fromEp.requestSchema?.required || []);
156
+ const toReq = new Set(toEp.requestSchema?.required || []);
157
+ for (const field of toReq) {
158
+ if (!fromReq.has(field)) {
159
+ changes.push(`Request body field "${field}" is now required`);
160
+ }
161
+ }
162
+ for (const field of fromReq) {
163
+ if (!toReq.has(field)) {
164
+ changes.push(`Request body field "${field}" is no longer required`);
165
+ }
166
+ }
167
+ return changes;
168
+ }
169
+ computeContentDiffs(options) {
170
+ const fromChunks = options.fromSnapshotId
171
+ ? this.repo.getChunksBySnapshot(options.fromSnapshotId)
172
+ : options.fromVersion
173
+ ? this.repo.getChunksByVersion(options.fromVersion)
174
+ : [];
175
+ const toChunks = options.toSnapshotId
176
+ ? this.repo.getChunksBySnapshot(options.toSnapshotId)
177
+ : options.toVersion
178
+ ? this.repo.getChunksByVersion(options.toVersion)
179
+ : [];
180
+ if (fromChunks.length === 0 && toChunks.length === 0)
181
+ return [];
182
+ const changes = [];
183
+ const fromMap = new Map(fromChunks.map(c => [c.title, c]));
184
+ const toMap = new Map(toChunks.map(c => [c.title, c]));
185
+ for (const [title, toC] of toMap.entries()) {
186
+ const fromC = fromMap.get(title);
187
+ if (!fromC) {
188
+ changes.push({
189
+ title,
190
+ changeType: 'added',
191
+ summary: `New documentation section: "${title}"`,
192
+ });
193
+ }
194
+ else if (fromC.contentHash !== toC.contentHash) {
195
+ // Compare normalized text to ignore formatting-only whitespace
196
+ const normFrom = fromC.content.replace(/\s+/g, ' ').trim();
197
+ const normTo = toC.content.replace(/\s+/g, ' ').trim();
198
+ if (normFrom !== normTo) {
199
+ changes.push({
200
+ title,
201
+ changeType: 'modified',
202
+ summary: `Content updated for section "${title}"`,
203
+ });
204
+ }
205
+ }
206
+ }
207
+ for (const title of fromMap.keys()) {
208
+ if (!toMap.has(title)) {
209
+ changes.push({
210
+ title,
211
+ changeType: 'removed',
212
+ summary: `Documentation section removed: "${title}"`,
213
+ });
214
+ }
215
+ }
216
+ return changes;
217
+ }
218
+ }
@@ -0,0 +1,29 @@
1
+ import type { ExtractedApiCall } from '../../shared/src/index.ts';
2
+ /**
3
+ * Normalizes an API path for comparison against schema paths.
4
+ * E.g. extracts pathname from full URLs ("https://api.stripe.com/v1/webhook_endpoints" -> "/v1/webhook_endpoints")
5
+ */
6
+ export declare function normalizeApiPath(urlOrPath: string): string;
7
+ /**
8
+ * Checks if an extracted path matches an OpenAPI schema path template.
9
+ * E.g. candidate "/v1/webhook_endpoints/we_123" matches schema "/v1/webhook_endpoints/{id}"
10
+ */
11
+ export declare function matchEndpointPath(candidatePath: string, schemaPath: string): boolean;
12
+ /**
13
+ * Deterministically extracts API calls, parameters, methods, and version syntax from code.
14
+ */
15
+ export declare class CodeApiExtractor {
16
+ /**
17
+ * Extracts API calls from code.
18
+ */
19
+ extract(code: string, language?: string): ExtractedApiCall[];
20
+ private findLineNumber;
21
+ private extractNextJsParams;
22
+ private extractFetchCalls;
23
+ private extractAxiosCalls;
24
+ private extractPythonRequestsCalls;
25
+ private extractCurlCalls;
26
+ private extractSdkCalls;
27
+ private extractDynamicCalls;
28
+ private extractResponseFields;
29
+ }