docorbit 0.1.0 → 0.1.2
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.
- package/README.md +29 -15
- package/bin/docorbit.js +2 -2
- package/dist/apps/cli/src/commands/add.d.ts +7 -0
- package/dist/apps/cli/src/commands/add.js +35 -0
- package/dist/apps/cli/src/commands/api.d.ts +2 -0
- package/dist/apps/cli/src/commands/api.js +35 -0
- package/dist/apps/cli/src/commands/context.d.ts +10 -0
- package/dist/apps/cli/src/commands/context.js +36 -0
- package/dist/apps/cli/src/commands/dashboard.d.ts +8 -0
- package/dist/apps/cli/src/commands/dashboard.js +43 -0
- package/dist/apps/cli/src/commands/diff.d.ts +2 -0
- package/dist/apps/cli/src/commands/diff.js +29 -0
- package/dist/apps/cli/src/commands/evaluate.d.ts +11 -0
- package/dist/apps/cli/src/commands/evaluate.js +101 -0
- package/dist/apps/cli/src/commands/examples.d.ts +2 -0
- package/dist/apps/cli/src/commands/examples.js +36 -0
- package/dist/apps/cli/src/commands/export.d.ts +11 -0
- package/dist/apps/cli/src/commands/export.js +72 -0
- package/dist/apps/cli/src/commands/impact.d.ts +2 -0
- package/dist/apps/cli/src/commands/impact.js +30 -0
- package/dist/apps/cli/src/commands/init.d.ts +5 -0
- package/dist/apps/cli/src/commands/init.js +52 -0
- package/dist/apps/cli/src/commands/inspect.d.ts +5 -0
- package/dist/apps/cli/src/commands/inspect.js +24 -0
- package/dist/apps/cli/src/commands/mcp.d.ts +8 -0
- package/dist/apps/cli/src/commands/mcp.js +49 -0
- package/dist/apps/cli/src/commands/pitfalls.d.ts +2 -0
- package/dist/apps/cli/src/commands/pitfalls.js +35 -0
- package/dist/apps/cli/src/commands/recipes.d.ts +2 -0
- package/dist/apps/cli/src/commands/recipes.js +33 -0
- package/dist/apps/cli/src/commands/search.d.ts +11 -0
- package/dist/apps/cli/src/commands/search.js +36 -0
- package/dist/apps/cli/src/commands/update.d.ts +6 -0
- package/dist/apps/cli/src/commands/update.js +53 -0
- package/dist/apps/cli/src/commands/verify.d.ts +2 -0
- package/dist/apps/cli/src/commands/verify.js +44 -0
- package/dist/apps/cli/src/formatters/colors.d.ts +21 -0
- package/dist/apps/cli/src/formatters/colors.js +22 -0
- package/dist/apps/cli/src/formatters/inspection.d.ts +3 -0
- package/dist/apps/cli/src/formatters/inspection.js +88 -0
- package/dist/apps/cli/src/formatters/knowledge.d.ts +5 -0
- package/dist/apps/cli/src/formatters/knowledge.js +229 -0
- package/dist/apps/cli/src/formatters/retrieval.d.ts +3 -0
- package/dist/apps/cli/src/formatters/retrieval.js +61 -0
- package/{apps/cli/src/formatters/terminal.ts → dist/apps/cli/src/formatters/terminal.d.ts} +0 -1
- package/dist/apps/cli/src/formatters/terminal.js +5 -0
- package/dist/apps/cli/src/formatters/verification.d.ts +4 -0
- package/dist/apps/cli/src/formatters/verification.js +102 -0
- package/dist/apps/cli/src/index.d.ts +1 -0
- package/dist/apps/cli/src/index.js +376 -0
- package/dist/packages/core/src/dashboard/server.d.ts +33 -0
- package/dist/packages/core/src/dashboard/server.js +267 -0
- package/dist/packages/core/src/dashboard/ui.d.ts +5 -0
- package/{packages/core/src/dashboard/ui.ts → dist/packages/core/src/dashboard/ui.js} +2 -2
- package/dist/packages/core/src/implementation-service.d.ts +73 -0
- package/dist/packages/core/src/implementation-service.js +325 -0
- package/{packages/core/src/index.ts → dist/packages/core/src/index.d.ts} +0 -1
- package/dist/packages/core/src/index.js +6 -0
- package/dist/packages/core/src/inspector.d.ts +22 -0
- package/dist/packages/core/src/inspector.js +38 -0
- package/dist/packages/core/src/pipeline.d.ts +45 -0
- package/dist/packages/core/src/pipeline.js +246 -0
- package/dist/packages/crawler/src/config.d.ts +2 -0
- package/dist/packages/crawler/src/config.js +10 -0
- package/dist/packages/crawler/src/fetcher.d.ts +31 -0
- package/dist/packages/crawler/src/fetcher.js +139 -0
- package/dist/packages/crawler/src/index.js +2 -0
- package/dist/packages/discovery/src/index.d.ts +11 -0
- package/dist/packages/discovery/src/index.js +29 -0
- package/dist/packages/discovery/src/provider.d.ts +12 -0
- package/dist/packages/discovery/src/provider.js +30 -0
- package/dist/packages/discovery/src/providers/generic.d.ts +7 -0
- package/dist/packages/discovery/src/providers/generic.js +94 -0
- package/dist/packages/discovery/src/providers/github.d.ts +7 -0
- package/dist/packages/discovery/src/providers/github.js +52 -0
- package/dist/packages/discovery/src/providers/llms-txt.d.ts +7 -0
- package/dist/packages/discovery/src/providers/llms-txt.js +60 -0
- package/dist/packages/discovery/src/providers/markdown.d.ts +7 -0
- package/dist/packages/discovery/src/providers/markdown.js +38 -0
- package/dist/packages/discovery/src/providers/openapi.d.ts +7 -0
- package/dist/packages/discovery/src/providers/openapi.js +77 -0
- package/dist/packages/discovery/src/providers/sitemap.d.ts +7 -0
- package/dist/packages/discovery/src/providers/sitemap.js +53 -0
- package/dist/packages/discovery/src/providers/skill.d.ts +7 -0
- package/dist/packages/discovery/src/providers/skill.js +46 -0
- package/dist/packages/discovery/src/ranker.d.ts +6 -0
- package/dist/packages/discovery/src/ranker.js +107 -0
- package/dist/packages/evaluation/src/dataset.d.ts +2 -0
- package/dist/packages/evaluation/src/dataset.js +944 -0
- package/dist/packages/evaluation/src/index.js +8 -0
- package/dist/packages/evaluation/src/runner.d.ts +7 -0
- package/dist/packages/evaluation/src/runner.js +196 -0
- package/dist/packages/evaluation/src/strategies/context7-runner.d.ts +24 -0
- package/dist/packages/evaluation/src/strategies/context7-runner.js +229 -0
- package/dist/packages/evaluation/src/strategies/docorbit-runner.d.ts +5 -0
- package/dist/packages/evaluation/src/strategies/docorbit-runner.js +210 -0
- package/dist/packages/evaluation/src/strategies/firecrawl-runner.d.ts +24 -0
- package/dist/packages/evaluation/src/strategies/firecrawl-runner.js +151 -0
- package/dist/packages/evaluation/src/strategies/web-search-runner.d.ts +32 -0
- package/dist/packages/evaluation/src/strategies/web-search-runner.js +161 -0
- package/dist/packages/evaluation/src/types.d.ts +15 -0
- package/dist/packages/evaluation/src/types.js +1 -0
- package/dist/packages/evaluation/src/version-matcher.d.ts +11 -0
- package/dist/packages/evaluation/src/version-matcher.js +61 -0
- package/dist/packages/export/src/agents-md.d.ts +19 -0
- package/dist/packages/export/src/agents-md.js +170 -0
- package/dist/packages/export/src/claude-md.d.ts +17 -0
- package/dist/packages/export/src/claude-md.js +118 -0
- package/dist/packages/export/src/docs-map.d.ts +14 -0
- package/dist/packages/export/src/docs-map.js +118 -0
- package/dist/packages/export/src/index.js +6 -0
- package/dist/packages/export/src/llms-txt.d.ts +15 -0
- package/dist/packages/export/src/llms-txt.js +73 -0
- package/dist/packages/export/src/service.d.ts +23 -0
- package/dist/packages/export/src/service.js +210 -0
- package/dist/packages/export/src/skill-md.d.ts +14 -0
- package/dist/packages/export/src/skill-md.js +107 -0
- package/{packages/mcp/src/index.ts → dist/packages/mcp/src/index.d.ts} +2 -35
- package/dist/packages/mcp/src/index.js +6 -0
- package/dist/packages/mcp/src/resources/index.d.ts +12 -0
- package/dist/packages/mcp/src/resources/index.js +165 -0
- package/dist/packages/mcp/src/server.d.ts +30 -0
- package/dist/packages/mcp/src/server.js +243 -0
- package/dist/packages/mcp/src/tools/analyze-impact.d.ts +6 -0
- package/dist/packages/mcp/src/tools/analyze-impact.js +64 -0
- package/dist/packages/mcp/src/tools/check-api.d.ts +6 -0
- package/dist/packages/mcp/src/tools/check-api.js +74 -0
- package/dist/packages/mcp/src/tools/diff-docs.d.ts +6 -0
- package/dist/packages/mcp/src/tools/diff-docs.js +58 -0
- package/dist/packages/mcp/src/tools/export-context.d.ts +6 -0
- package/dist/packages/mcp/src/tools/export-context.js +61 -0
- package/dist/packages/mcp/src/tools/find-api.d.ts +6 -0
- package/dist/packages/mcp/src/tools/find-api.js +91 -0
- package/dist/packages/mcp/src/tools/find-example.d.ts +6 -0
- package/dist/packages/mcp/src/tools/find-example.js +92 -0
- package/dist/packages/mcp/src/tools/find-pitfall.d.ts +6 -0
- package/dist/packages/mcp/src/tools/find-pitfall.js +85 -0
- package/dist/packages/mcp/src/tools/find-recipe.d.ts +6 -0
- package/dist/packages/mcp/src/tools/find-recipe.js +89 -0
- package/dist/packages/mcp/src/tools/get-doc.d.ts +6 -0
- package/dist/packages/mcp/src/tools/get-doc.js +118 -0
- package/dist/packages/mcp/src/tools/get-docs-map.d.ts +6 -0
- package/dist/packages/mcp/src/tools/get-docs-map.js +54 -0
- package/dist/packages/mcp/src/tools/get-version.d.ts +6 -0
- package/dist/packages/mcp/src/tools/get-version.js +104 -0
- package/dist/packages/mcp/src/tools/implementation-context.d.ts +6 -0
- package/dist/packages/mcp/src/tools/implementation-context.js +102 -0
- package/dist/packages/mcp/src/tools/index.d.ts +19 -0
- package/dist/packages/mcp/src/tools/index.js +41 -0
- package/dist/packages/mcp/src/tools/ingest-doc.d.ts +6 -0
- package/dist/packages/mcp/src/tools/ingest-doc.js +264 -0
- package/dist/packages/mcp/src/tools/list-sources.d.ts +6 -0
- package/dist/packages/mcp/src/tools/list-sources.js +76 -0
- package/dist/packages/mcp/src/tools/search-docs.d.ts +6 -0
- package/dist/packages/mcp/src/tools/search-docs.js +113 -0
- package/dist/packages/mcp/src/tools/types.d.ts +22 -0
- package/dist/packages/mcp/src/tools/types.js +1 -0
- package/dist/packages/mcp/src/transports/http.d.ts +31 -0
- package/dist/packages/mcp/src/transports/http.js +215 -0
- package/dist/packages/mcp/src/transports/stdio.d.ts +22 -0
- package/dist/packages/mcp/src/transports/stdio.js +86 -0
- package/{packages/mcp/src/transports/types.ts → dist/packages/mcp/src/transports/types.d.ts} +2 -3
- package/dist/packages/mcp/src/transports/types.js +1 -0
- package/dist/packages/mcp/src/types.d.ts +89 -0
- package/dist/packages/mcp/src/types.js +7 -0
- package/dist/packages/normalizer/src/example-indexer.d.ts +5 -0
- package/dist/packages/normalizer/src/example-indexer.js +200 -0
- package/dist/packages/normalizer/src/html.d.ts +13 -0
- package/dist/packages/normalizer/src/html.js +221 -0
- package/{packages/normalizer/src/index.ts → dist/packages/normalizer/src/index.d.ts} +0 -1
- package/dist/packages/normalizer/src/index.js +7 -0
- package/dist/packages/normalizer/src/llms.d.ts +3 -0
- package/dist/packages/normalizer/src/llms.js +71 -0
- package/dist/packages/normalizer/src/openapi/endpoint-parser.d.ts +11 -0
- package/dist/packages/normalizer/src/openapi/endpoint-parser.js +357 -0
- package/dist/packages/normalizer/src/openapi/schema-resolver.d.ts +10 -0
- package/dist/packages/normalizer/src/openapi/schema-resolver.js +82 -0
- package/dist/packages/normalizer/src/openapi.js +2 -0
- package/dist/packages/normalizer/src/page.d.ts +13 -0
- package/dist/packages/normalizer/src/page.js +150 -0
- package/dist/packages/normalizer/src/pitfall-extractor.d.ts +6 -0
- package/dist/packages/normalizer/src/pitfall-extractor.js +153 -0
- package/dist/packages/normalizer/src/slicer.d.ts +30 -0
- package/dist/packages/normalizer/src/slicer.js +360 -0
- package/dist/packages/retrieval/src/engine.d.ts +17 -0
- package/dist/packages/retrieval/src/engine.js +93 -0
- package/{packages/retrieval/src/index.ts → dist/packages/retrieval/src/index.d.ts} +0 -1
- package/dist/packages/retrieval/src/index.js +6 -0
- package/dist/packages/retrieval/src/intent.d.ts +6 -0
- package/dist/packages/retrieval/src/intent.js +39 -0
- package/dist/packages/retrieval/src/packer.d.ts +2 -0
- package/dist/packages/retrieval/src/packer.js +108 -0
- package/dist/packages/retrieval/src/recipe-engine.d.ts +18 -0
- package/dist/packages/retrieval/src/recipe-engine.js +265 -0
- package/dist/packages/retrieval/src/scorer.d.ts +13 -0
- package/dist/packages/retrieval/src/scorer.js +110 -0
- package/dist/packages/retrieval/src/weights.d.ts +3 -0
- package/dist/packages/retrieval/src/weights.js +28 -0
- package/dist/packages/security/src/annotations.d.ts +10 -0
- package/dist/packages/security/src/annotations.js +100 -0
- package/dist/packages/security/src/index.js +2 -0
- package/dist/packages/security/src/ssrf.d.ts +17 -0
- package/dist/packages/security/src/ssrf.js +132 -0
- package/dist/packages/shared/src/errors.d.ts +22 -0
- package/dist/packages/shared/src/errors.js +44 -0
- package/dist/packages/shared/src/hashing.d.ts +3 -0
- package/dist/packages/shared/src/hashing.js +21 -0
- package/dist/packages/shared/src/index.js +3 -0
- package/dist/packages/shared/src/types.d.ts +715 -0
- package/dist/packages/shared/src/types.js +1 -0
- package/dist/packages/storage/src/db.d.ts +11 -0
- package/dist/packages/storage/src/db.js +128 -0
- package/dist/packages/storage/src/index.js +10 -0
- package/dist/packages/storage/src/interfaces.d.ts +83 -0
- package/dist/packages/storage/src/interfaces.js +1 -0
- package/dist/packages/storage/src/repositories/api-repository.d.ts +16 -0
- package/dist/packages/storage/src/repositories/api-repository.js +169 -0
- package/dist/packages/storage/src/repositories/chunk-repository.d.ts +32 -0
- package/dist/packages/storage/src/repositories/chunk-repository.js +250 -0
- package/dist/packages/storage/src/repositories/example-repository.d.ts +16 -0
- package/dist/packages/storage/src/repositories/example-repository.js +158 -0
- package/dist/packages/storage/src/repositories/page-repository.d.ts +16 -0
- package/dist/packages/storage/src/repositories/page-repository.js +161 -0
- package/dist/packages/storage/src/repositories/pitfall-repository.d.ts +15 -0
- package/dist/packages/storage/src/repositories/pitfall-repository.js +144 -0
- package/dist/packages/storage/src/repositories/source-repository.d.ts +33 -0
- package/dist/packages/storage/src/repositories/source-repository.js +153 -0
- package/dist/packages/storage/src/repository.d.ts +92 -0
- package/dist/packages/storage/src/repository.js +157 -0
- package/dist/packages/storage/src/schema.d.ts +2 -0
- package/{packages/storage/src/schema.ts → dist/packages/storage/src/schema.js} +0 -3
- package/dist/packages/storage/src/search-tokens.d.ts +6 -0
- package/dist/packages/storage/src/search-tokens.js +26 -0
- package/dist/packages/verification/src/diff-engine.d.ts +18 -0
- package/dist/packages/verification/src/diff-engine.js +218 -0
- package/dist/packages/verification/src/extractor.d.ts +29 -0
- package/dist/packages/verification/src/extractor.js +302 -0
- package/dist/packages/verification/src/impact-scanner.d.ts +9 -0
- package/dist/packages/verification/src/impact-scanner.js +181 -0
- package/dist/packages/verification/src/index.js +5 -0
- package/dist/packages/verification/src/services.d.ts +55 -0
- package/dist/packages/verification/src/services.js +189 -0
- package/dist/packages/verification/src/verifier.d.ts +15 -0
- package/dist/packages/verification/src/verifier.js +315 -0
- package/dist/packages/workspace/src/detector.d.ts +7 -0
- package/dist/packages/workspace/src/detector.js +117 -0
- package/dist/packages/workspace/src/ecosystems/cargo.d.ts +10 -0
- package/dist/packages/workspace/src/ecosystems/cargo.js +69 -0
- package/dist/packages/workspace/src/ecosystems/composer.d.ts +7 -0
- package/dist/packages/workspace/src/ecosystems/composer.js +40 -0
- package/dist/packages/workspace/src/ecosystems/go.d.ts +7 -0
- package/dist/packages/workspace/src/ecosystems/go.js +49 -0
- package/{packages/workspace/src/ecosystems/index.ts → dist/packages/workspace/src/ecosystems/index.d.ts} +2 -24
- package/dist/packages/workspace/src/ecosystems/index.js +21 -0
- package/dist/packages/workspace/src/ecosystems/maven.d.ts +7 -0
- package/dist/packages/workspace/src/ecosystems/maven.js +28 -0
- package/dist/packages/workspace/src/ecosystems/npm.d.ts +10 -0
- package/dist/packages/workspace/src/ecosystems/npm.js +73 -0
- package/dist/packages/workspace/src/ecosystems/pub.d.ts +7 -0
- package/dist/packages/workspace/src/ecosystems/pub.js +34 -0
- package/dist/packages/workspace/src/ecosystems/pypi.d.ts +9 -0
- package/dist/packages/workspace/src/ecosystems/pypi.js +94 -0
- package/dist/packages/workspace/src/ecosystems/rubygems.d.ts +7 -0
- package/dist/packages/workspace/src/ecosystems/rubygems.js +25 -0
- package/dist/packages/workspace/src/ecosystems/types.d.ts +9 -0
- package/dist/packages/workspace/src/ecosystems/types.js +1 -0
- package/dist/packages/workspace/src/index.js +5 -0
- package/dist/packages/workspace/src/lockfile.d.ts +21 -0
- package/dist/packages/workspace/src/lockfile.js +153 -0
- package/dist/packages/workspace/src/resolver.d.ts +39 -0
- package/dist/packages/workspace/src/resolver.js +164 -0
- package/dist/packages/workspace/src/semver.d.ts +33 -0
- package/dist/packages/workspace/src/semver.js +235 -0
- package/package.json +13 -9
- package/apps/cli/bin/docorbit.js +0 -8
- package/apps/cli/src/commands/add.ts +0 -44
- package/apps/cli/src/commands/api.ts +0 -38
- package/apps/cli/src/commands/context.ts +0 -47
- package/apps/cli/src/commands/dashboard.ts +0 -55
- package/apps/cli/src/commands/diff.ts +0 -30
- package/apps/cli/src/commands/evaluate.ts +0 -133
- package/apps/cli/src/commands/examples.ts +0 -39
- package/apps/cli/src/commands/export.ts +0 -89
- package/apps/cli/src/commands/impact.ts +0 -31
- package/apps/cli/src/commands/init.ts +0 -69
- package/apps/cli/src/commands/inspect.ts +0 -30
- package/apps/cli/src/commands/mcp.ts +0 -72
- package/apps/cli/src/commands/pitfalls.ts +0 -38
- package/apps/cli/src/commands/recipes.ts +0 -35
- package/apps/cli/src/commands/search.ts +0 -48
- package/apps/cli/src/commands/update.ts +0 -73
- package/apps/cli/src/commands/verify.ts +0 -48
- package/apps/cli/src/formatters/colors.ts +0 -23
- package/apps/cli/src/formatters/inspection.ts +0 -102
- package/apps/cli/src/formatters/knowledge.ts +0 -272
- package/apps/cli/src/formatters/retrieval.ts +0 -74
- package/apps/cli/src/formatters/verification.ts +0 -126
- package/apps/cli/src/index.ts +0 -409
- package/packages/core/src/dashboard/server.ts +0 -314
- package/packages/core/src/implementation-service.ts +0 -451
- package/packages/core/src/inspector.ts +0 -71
- package/packages/core/src/pipeline.ts +0 -331
- package/packages/crawler/src/config.ts +0 -12
- package/packages/crawler/src/fetcher.ts +0 -185
- package/packages/discovery/src/index.ts +0 -31
- package/packages/discovery/src/provider.ts +0 -47
- package/packages/discovery/src/providers/generic.ts +0 -98
- package/packages/discovery/src/providers/github.ts +0 -61
- package/packages/discovery/src/providers/llms-txt.ts +0 -73
- package/packages/discovery/src/providers/markdown.ts +0 -48
- package/packages/discovery/src/providers/openapi.ts +0 -91
- package/packages/discovery/src/providers/sitemap.ts +0 -62
- package/packages/discovery/src/providers/skill.ts +0 -54
- package/packages/discovery/src/ranker.ts +0 -123
- package/packages/evaluation/src/dataset.ts +0 -963
- package/packages/evaluation/src/runner.ts +0 -241
- package/packages/evaluation/src/strategies/context7-runner.ts +0 -269
- package/packages/evaluation/src/strategies/docorbit-runner.ts +0 -228
- package/packages/evaluation/src/strategies/firecrawl-runner.ts +0 -172
- package/packages/evaluation/src/strategies/web-search-runner.ts +0 -194
- package/packages/evaluation/src/types.ts +0 -34
- package/packages/evaluation/src/version-matcher.ts +0 -73
- package/packages/export/src/agents-md.ts +0 -200
- package/packages/export/src/claude-md.ts +0 -141
- package/packages/export/src/docs-map.ts +0 -150
- package/packages/export/src/llms-txt.ts +0 -96
- package/packages/export/src/service.ts +0 -250
- package/packages/export/src/skill-md.ts +0 -128
- package/packages/mcp/src/resources/index.ts +0 -189
- package/packages/mcp/src/server.ts +0 -278
- package/packages/mcp/src/tools/analyze-impact.ts +0 -74
- package/packages/mcp/src/tools/check-api.ts +0 -86
- package/packages/mcp/src/tools/diff-docs.ts +0 -68
- package/packages/mcp/src/tools/export-context.ts +0 -73
- package/packages/mcp/src/tools/find-api.ts +0 -99
- package/packages/mcp/src/tools/find-example.ts +0 -100
- package/packages/mcp/src/tools/find-pitfall.ts +0 -94
- package/packages/mcp/src/tools/find-recipe.ts +0 -98
- package/packages/mcp/src/tools/get-doc.ts +0 -130
- package/packages/mcp/src/tools/get-docs-map.ts +0 -64
- package/packages/mcp/src/tools/get-version.ts +0 -118
- package/packages/mcp/src/tools/implementation-context.ts +0 -88
- package/packages/mcp/src/tools/index.ts +0 -59
- package/packages/mcp/src/tools/list-sources.ts +0 -85
- package/packages/mcp/src/tools/search-docs.ts +0 -123
- package/packages/mcp/src/tools/types.ts +0 -28
- package/packages/mcp/src/transports/http.ts +0 -256
- package/packages/mcp/src/transports/stdio.ts +0 -105
- package/packages/mcp/src/types.ts +0 -102
- package/packages/normalizer/src/example-indexer.ts +0 -240
- package/packages/normalizer/src/html.ts +0 -253
- package/packages/normalizer/src/llms.ts +0 -83
- package/packages/normalizer/src/openapi/endpoint-parser.ts +0 -406
- package/packages/normalizer/src/openapi/schema-resolver.ts +0 -111
- package/packages/normalizer/src/page.ts +0 -184
- package/packages/normalizer/src/pitfall-extractor.ts +0 -190
- package/packages/normalizer/src/slicer.ts +0 -455
- package/packages/retrieval/src/engine.ts +0 -120
- package/packages/retrieval/src/intent.ts +0 -43
- package/packages/retrieval/src/packer.ts +0 -145
- package/packages/retrieval/src/recipe-engine.ts +0 -313
- package/packages/retrieval/src/scorer.ts +0 -139
- package/packages/retrieval/src/weights.ts +0 -31
- package/packages/security/src/annotations.ts +0 -112
- package/packages/security/src/ssrf.ts +0 -153
- package/packages/shared/src/errors.ts +0 -53
- package/packages/shared/src/hashing.ts +0 -23
- package/packages/shared/src/types.ts +0 -881
- package/packages/storage/src/db.ts +0 -72
- package/packages/storage/src/interfaces.ts +0 -115
- package/packages/storage/src/repositories/api-repository.ts +0 -219
- package/packages/storage/src/repositories/chunk-repository.ts +0 -316
- package/packages/storage/src/repositories/example-repository.ts +0 -206
- package/packages/storage/src/repositories/page-repository.ts +0 -205
- package/packages/storage/src/repositories/pitfall-repository.ts +0 -188
- package/packages/storage/src/repositories/source-repository.ts +0 -205
- package/packages/storage/src/repository.ts +0 -256
- package/packages/storage/src/search-tokens.ts +0 -28
- package/packages/verification/src/diff-engine.ts +0 -258
- package/packages/verification/src/extractor.ts +0 -339
- package/packages/verification/src/impact-scanner.ts +0 -203
- package/packages/verification/src/services.ts +0 -238
- package/packages/verification/src/verifier.ts +0 -375
- package/packages/workspace/src/detector.ts +0 -143
- package/packages/workspace/src/ecosystems/cargo.ts +0 -84
- package/packages/workspace/src/ecosystems/composer.ts +0 -42
- package/packages/workspace/src/ecosystems/go.ts +0 -54
- package/packages/workspace/src/ecosystems/maven.ts +0 -34
- package/packages/workspace/src/ecosystems/npm.ts +0 -83
- package/packages/workspace/src/ecosystems/pub.ts +0 -40
- package/packages/workspace/src/ecosystems/pypi.ts +0 -100
- package/packages/workspace/src/ecosystems/rubygems.ts +0 -30
- package/packages/workspace/src/ecosystems/types.ts +0 -18
- package/packages/workspace/src/lockfile.ts +0 -194
- package/packages/workspace/src/resolver.ts +0 -234
- package/packages/workspace/src/semver.ts +0 -259
- /package/{packages/crawler/src/index.ts → dist/packages/crawler/src/index.d.ts} +0 -0
- /package/{packages/evaluation/src/index.ts → dist/packages/evaluation/src/index.d.ts} +0 -0
- /package/{packages/export/src/index.ts → dist/packages/export/src/index.d.ts} +0 -0
- /package/{packages/normalizer/src/openapi.ts → dist/packages/normalizer/src/openapi.d.ts} +0 -0
- /package/{packages/security/src/index.ts → dist/packages/security/src/index.d.ts} +0 -0
- /package/{packages/shared/src/index.ts → dist/packages/shared/src/index.d.ts} +0 -0
- /package/{packages/storage/src/index.ts → dist/packages/storage/src/index.d.ts} +0 -0
- /package/{packages/verification/src/index.ts → dist/packages/verification/src/index.d.ts} +0 -0
- /package/{packages/workspace/src/index.ts → dist/packages/workspace/src/index.d.ts} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { IngestionPipeline } from "../../../core/src/index.js";
|
|
2
|
+
export class ImplementationContextTool {
|
|
3
|
+
definition = {
|
|
4
|
+
name: 'get_implementation_context',
|
|
5
|
+
description: 'High-level documentation intelligence orchestrator. Automatically resolves workspace dependencies and versions, detects task intent, retrieves relevant chunks, APIs, verified examples, and pitfalls, and compiles an evidence-grounded recipe within a strict token budget.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
task: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: 'The specific coding task or feature to implement (e.g. "Implement Stripe webhook signature verification in Express").',
|
|
12
|
+
},
|
|
13
|
+
url: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Optional documentation target URL. If provided and not yet indexed in DocOrbit, DocOrbit will automatically ingest and index it before compiling context.',
|
|
16
|
+
},
|
|
17
|
+
project: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Path to repository workspace root for project-aware dependency detection (default: current directory).',
|
|
20
|
+
},
|
|
21
|
+
library: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'Optional primary library or package to focus documentation on (e.g. "stripe", "next").',
|
|
24
|
+
},
|
|
25
|
+
version: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'Optional explicit target documentation version (e.g. "v14", "15.0").',
|
|
28
|
+
},
|
|
29
|
+
tokenBudget: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
description: 'Maximum token budget for packed context (default: 4000).',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: ['task'],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
async execute(args, ctx) {
|
|
38
|
+
const task = typeof args.task === 'string' ? args.task.trim() : '';
|
|
39
|
+
if (!task) {
|
|
40
|
+
return {
|
|
41
|
+
isError: true,
|
|
42
|
+
content: [{ type: 'text', text: JSON.stringify({ error: 'Missing required parameter: task' }) }],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const projectPath = typeof args.project === 'string'
|
|
46
|
+
? args.project
|
|
47
|
+
: (ctx.workspaceRoot || '.');
|
|
48
|
+
const library = typeof args.library === 'string' ? args.library : undefined;
|
|
49
|
+
const version = typeof args.version === 'string' ? args.version : undefined;
|
|
50
|
+
const tokenBudget = typeof args.tokenBudget === 'number' && args.tokenBudget > 0
|
|
51
|
+
? args.tokenBudget
|
|
52
|
+
: 4000;
|
|
53
|
+
const url = typeof args.url === 'string' ? args.url.trim() : undefined;
|
|
54
|
+
try {
|
|
55
|
+
if (url) {
|
|
56
|
+
const existing = ctx.repo.getSourceByUrl(url);
|
|
57
|
+
if (!existing) {
|
|
58
|
+
try {
|
|
59
|
+
const pipeline = new IngestionPipeline(ctx.repo, {
|
|
60
|
+
crawlerConfig: { maxPages: 20 },
|
|
61
|
+
});
|
|
62
|
+
await pipeline.ingest(url);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Proceed gracefully with available context if crawling fails
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const result = await ctx.implService.getContext({
|
|
70
|
+
task,
|
|
71
|
+
projectPath,
|
|
72
|
+
library,
|
|
73
|
+
version,
|
|
74
|
+
tokenBudget,
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: 'text',
|
|
80
|
+
text: JSON.stringify({
|
|
81
|
+
markdown: result.markdown,
|
|
82
|
+
data: result,
|
|
83
|
+
}, null, 2),
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
return {
|
|
90
|
+
isError: true,
|
|
91
|
+
content: [
|
|
92
|
+
{
|
|
93
|
+
type: 'text',
|
|
94
|
+
text: JSON.stringify({
|
|
95
|
+
error: `Failed to compile implementation context: ${err instanceof Error ? err.message : String(err)}`,
|
|
96
|
+
}),
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { McpToolHandler } from './types.ts';
|
|
2
|
+
import { SearchDocsTool } from './search-docs.ts';
|
|
3
|
+
import { GetDocTool } from './get-doc.ts';
|
|
4
|
+
import { FindApiTool } from './find-api.ts';
|
|
5
|
+
import { FindExampleTool } from './find-example.ts';
|
|
6
|
+
import { FindPitfallTool } from './find-pitfall.ts';
|
|
7
|
+
import { FindRecipeTool } from './find-recipe.ts';
|
|
8
|
+
import { GetVersionTool } from './get-version.ts';
|
|
9
|
+
import { ListSourcesTool } from './list-sources.ts';
|
|
10
|
+
import { ImplementationContextTool } from './implementation-context.ts';
|
|
11
|
+
import { CheckApiTool } from './check-api.ts';
|
|
12
|
+
import { DiffDocsTool } from './diff-docs.ts';
|
|
13
|
+
import { AnalyzeImpactTool } from './analyze-impact.ts';
|
|
14
|
+
import { GetDocumentationMapTool } from './get-docs-map.ts';
|
|
15
|
+
import { ExportAgentContextTool } from './export-context.ts';
|
|
16
|
+
import { IngestDocTool } from './ingest-doc.ts';
|
|
17
|
+
export * from './types.ts';
|
|
18
|
+
export { SearchDocsTool, GetDocTool, FindApiTool, FindExampleTool, FindPitfallTool, FindRecipeTool, GetVersionTool, ListSourcesTool, ImplementationContextTool, ImplementationContextTool as GetImplementationContextTool, CheckApiTool, DiffDocsTool, AnalyzeImpactTool, GetDocumentationMapTool, ExportAgentContextTool, IngestDocTool, };
|
|
19
|
+
export declare function createDefaultTools(): Map<string, McpToolHandler>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SearchDocsTool } from "./search-docs.js";
|
|
2
|
+
import { GetDocTool } from "./get-doc.js";
|
|
3
|
+
import { FindApiTool } from "./find-api.js";
|
|
4
|
+
import { FindExampleTool } from "./find-example.js";
|
|
5
|
+
import { FindPitfallTool } from "./find-pitfall.js";
|
|
6
|
+
import { FindRecipeTool } from "./find-recipe.js";
|
|
7
|
+
import { GetVersionTool } from "./get-version.js";
|
|
8
|
+
import { ListSourcesTool } from "./list-sources.js";
|
|
9
|
+
import { ImplementationContextTool } from "./implementation-context.js";
|
|
10
|
+
import { CheckApiTool } from "./check-api.js";
|
|
11
|
+
import { DiffDocsTool } from "./diff-docs.js";
|
|
12
|
+
import { AnalyzeImpactTool } from "./analyze-impact.js";
|
|
13
|
+
import { GetDocumentationMapTool } from "./get-docs-map.js";
|
|
14
|
+
import { ExportAgentContextTool } from "./export-context.js";
|
|
15
|
+
import { IngestDocTool } from "./ingest-doc.js";
|
|
16
|
+
export * from "./types.js";
|
|
17
|
+
export { SearchDocsTool, GetDocTool, FindApiTool, FindExampleTool, FindPitfallTool, FindRecipeTool, GetVersionTool, ListSourcesTool, ImplementationContextTool, ImplementationContextTool as GetImplementationContextTool, CheckApiTool, DiffDocsTool, AnalyzeImpactTool, GetDocumentationMapTool, ExportAgentContextTool, IngestDocTool, };
|
|
18
|
+
export function createDefaultTools() {
|
|
19
|
+
const tools = new Map();
|
|
20
|
+
const list = [
|
|
21
|
+
new SearchDocsTool(),
|
|
22
|
+
new GetDocTool(),
|
|
23
|
+
new FindApiTool(),
|
|
24
|
+
new FindExampleTool(),
|
|
25
|
+
new FindPitfallTool(),
|
|
26
|
+
new FindRecipeTool(),
|
|
27
|
+
new GetVersionTool(),
|
|
28
|
+
new ListSourcesTool(),
|
|
29
|
+
new ImplementationContextTool(),
|
|
30
|
+
new CheckApiTool(),
|
|
31
|
+
new DiffDocsTool(),
|
|
32
|
+
new AnalyzeImpactTool(),
|
|
33
|
+
new GetDocumentationMapTool(),
|
|
34
|
+
new ExportAgentContextTool(),
|
|
35
|
+
new IngestDocTool(),
|
|
36
|
+
];
|
|
37
|
+
for (const tool of list) {
|
|
38
|
+
tools.set(tool.definition.name, tool);
|
|
39
|
+
}
|
|
40
|
+
return tools;
|
|
41
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CallToolResult, McpTool } from '../types.ts';
|
|
2
|
+
import type { McpContext, McpToolHandler } from './types.ts';
|
|
3
|
+
export declare class IngestDocTool implements McpToolHandler {
|
|
4
|
+
readonly definition: McpTool;
|
|
5
|
+
execute(args: Record<string, unknown>, ctx: McpContext): Promise<CallToolResult>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { IngestionPipeline } from "../../../core/src/index.js";
|
|
2
|
+
import { buildNormalizedPage, slicePageIntoChunks } from "../../../normalizer/src/index.js";
|
|
3
|
+
export class IngestDocTool {
|
|
4
|
+
definition = {
|
|
5
|
+
name: 'ingest_doc',
|
|
6
|
+
description: 'Ingest, crawl, parse, and index authoritative documentation from any URL or raw content directly into DocOrbit. Extracts semantic chunks, OpenAPI endpoints, code examples, and pitfalls. If taskContext is provided, immediately synthesizes and returns an evidence-grounded implementation recipe with exact code and API details.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
url: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Documentation target URL to crawl and ingest (e.g. "https://nextjs.org/docs" or "https://support.atlassian.com/...").',
|
|
13
|
+
},
|
|
14
|
+
taskContext: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Optional coding task or intent (e.g. "Connect Atlassian Remote MCP" or "Implement Stripe payment element"). If provided, DocOrbit compiles and returns an immediate implementation recipe using the newly ingested docs.',
|
|
17
|
+
},
|
|
18
|
+
maxPages: {
|
|
19
|
+
type: 'number',
|
|
20
|
+
description: 'Maximum number of pages to crawl (default: 20, max: 50).',
|
|
21
|
+
},
|
|
22
|
+
content: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Optional raw markdown/HTML documentation content to index directly without fetching from the web.',
|
|
25
|
+
},
|
|
26
|
+
title: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Optional title when ingesting raw content or overriding page title.',
|
|
29
|
+
},
|
|
30
|
+
allowLocalhost: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
description: 'Allow crawling localhost endpoints for testing (default: false).',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
async execute(args, ctx) {
|
|
38
|
+
const rawUrl = typeof args.url === 'string' ? args.url.trim() : '';
|
|
39
|
+
const rawContent = typeof args.content === 'string' ? args.content.trim() : '';
|
|
40
|
+
const title = typeof args.title === 'string' ? args.title.trim() : undefined;
|
|
41
|
+
const taskContext = typeof args.taskContext === 'string' ? args.taskContext.trim() : undefined;
|
|
42
|
+
const allowLocalhost = Boolean(args.allowLocalhost);
|
|
43
|
+
const maxPages = typeof args.maxPages === 'number' && args.maxPages > 0
|
|
44
|
+
? Math.min(args.maxPages, 50)
|
|
45
|
+
: 20;
|
|
46
|
+
if (!rawUrl && !rawContent) {
|
|
47
|
+
return {
|
|
48
|
+
isError: true,
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: 'text',
|
|
52
|
+
text: JSON.stringify({
|
|
53
|
+
error: 'Missing required parameter: provide either "url" to crawl documentation from the web or "content" to index raw documentation.',
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
let targetUrl = rawUrl;
|
|
61
|
+
let snapshotId = '';
|
|
62
|
+
let pagesCount = 0;
|
|
63
|
+
let chunksCount = 0;
|
|
64
|
+
let codeExamplesCount = 0;
|
|
65
|
+
let estimatedTokens = 0;
|
|
66
|
+
let durationMs = 0;
|
|
67
|
+
const pagesSummary = [];
|
|
68
|
+
if (rawContent) {
|
|
69
|
+
const startTime = Date.now();
|
|
70
|
+
targetUrl = rawUrl || 'local://direct-content';
|
|
71
|
+
const sourceId = ctx.repo.saveSource({
|
|
72
|
+
url: targetUrl,
|
|
73
|
+
type: 'web',
|
|
74
|
+
discoveredBy: 'direct',
|
|
75
|
+
status: 'valid',
|
|
76
|
+
confidence: 1.0,
|
|
77
|
+
authority: 'official',
|
|
78
|
+
machineReadable: false,
|
|
79
|
+
});
|
|
80
|
+
snapshotId = ctx.repo.createSnapshot(sourceId, {
|
|
81
|
+
targetUrl,
|
|
82
|
+
pageCount: 1,
|
|
83
|
+
ingestedAt: new Date().toISOString(),
|
|
84
|
+
});
|
|
85
|
+
const page = buildNormalizedPage({
|
|
86
|
+
sourceId,
|
|
87
|
+
url: targetUrl,
|
|
88
|
+
rawContent,
|
|
89
|
+
contentType: 'text/markdown',
|
|
90
|
+
sourceUrl: targetUrl,
|
|
91
|
+
targetUrl,
|
|
92
|
+
title: title || 'Direct Content Ingestion',
|
|
93
|
+
discoveredBy: 'direct',
|
|
94
|
+
fetchedAt: new Date().toISOString(),
|
|
95
|
+
});
|
|
96
|
+
ctx.repo.savePage(page);
|
|
97
|
+
const slicing = slicePageIntoChunks(page, snapshotId);
|
|
98
|
+
ctx.repo.saveChunks(slicing.chunks, slicing.relationships, slicing.codeSnippets, slicing.symbols);
|
|
99
|
+
pagesCount = 1;
|
|
100
|
+
chunksCount = slicing.chunks.length;
|
|
101
|
+
codeExamplesCount = page.codeExamples.length;
|
|
102
|
+
estimatedTokens = page.estimatedTokens;
|
|
103
|
+
durationMs = Date.now() - startTime;
|
|
104
|
+
pagesSummary.push({
|
|
105
|
+
title: page.title,
|
|
106
|
+
url: page.url,
|
|
107
|
+
tokens: page.estimatedTokens,
|
|
108
|
+
codeBlocks: page.codeExamples.length,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const pipeline = new IngestionPipeline(ctx.repo, {
|
|
113
|
+
allowLocalhostForTesting: allowLocalhost,
|
|
114
|
+
crawlerConfig: {
|
|
115
|
+
maxPages,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
const result = await pipeline.ingest(rawUrl);
|
|
119
|
+
targetUrl = result.targetUrl;
|
|
120
|
+
snapshotId = result.snapshotId;
|
|
121
|
+
pagesCount = result.stats.totalPages;
|
|
122
|
+
chunksCount = result.stats.totalChunks;
|
|
123
|
+
codeExamplesCount = result.stats.totalCodeExamples;
|
|
124
|
+
estimatedTokens = result.stats.totalEstimatedTokens;
|
|
125
|
+
durationMs = result.durationMs;
|
|
126
|
+
for (const p of result.pages) {
|
|
127
|
+
pagesSummary.push({
|
|
128
|
+
title: p.title,
|
|
129
|
+
url: p.url,
|
|
130
|
+
tokens: p.estimatedTokens,
|
|
131
|
+
codeBlocks: p.codeExamples.length,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// If user provided a specific task context, compile an immediate implementation context recipe!
|
|
136
|
+
if (taskContext) {
|
|
137
|
+
const implResult = await ctx.implService.getContext({
|
|
138
|
+
task: taskContext,
|
|
139
|
+
projectPath: ctx.projectDir || ctx.workspaceRoot,
|
|
140
|
+
tokenBudget: 4000,
|
|
141
|
+
});
|
|
142
|
+
const lines = [
|
|
143
|
+
`# 🛰️ DocOrbit: Ingested & Context Compiled`,
|
|
144
|
+
`> [!NOTE]`,
|
|
145
|
+
`> Successfully ingested **${targetUrl}** and compiled implementation context for: *"${taskContext}"*`,
|
|
146
|
+
``,
|
|
147
|
+
`### Ingestion Metrics`,
|
|
148
|
+
`- **Pages Ingested**: ${pagesCount}`,
|
|
149
|
+
`- **Chunks Indexed**: ${chunksCount}`,
|
|
150
|
+
`- **Code Examples Extracted**: ${codeExamplesCount}`,
|
|
151
|
+
`- **Estimated Tokens**: ~${estimatedTokens}`,
|
|
152
|
+
`- **Snapshot ID**: \`${snapshotId}\` (${durationMs}ms)`,
|
|
153
|
+
``,
|
|
154
|
+
`---`,
|
|
155
|
+
``,
|
|
156
|
+
implResult.markdown,
|
|
157
|
+
];
|
|
158
|
+
return {
|
|
159
|
+
content: [
|
|
160
|
+
{
|
|
161
|
+
type: 'text',
|
|
162
|
+
text: JSON.stringify({
|
|
163
|
+
markdown: lines.join('\n'),
|
|
164
|
+
data: {
|
|
165
|
+
targetUrl,
|
|
166
|
+
snapshotId,
|
|
167
|
+
taskContext,
|
|
168
|
+
stats: {
|
|
169
|
+
pagesCount,
|
|
170
|
+
chunksCount,
|
|
171
|
+
codeExamplesCount,
|
|
172
|
+
estimatedTokens,
|
|
173
|
+
durationMs,
|
|
174
|
+
},
|
|
175
|
+
implementationContext: implResult,
|
|
176
|
+
},
|
|
177
|
+
}, null, 2),
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
// Query any extracted APIs, examples, and pitfalls from the new documentation
|
|
183
|
+
const apiEndpoints = ctx.repo.searchApiEndpoints(targetUrl, { limit: 5 });
|
|
184
|
+
const codeExamples = ctx.repo.searchIndexedExamples(targetUrl, { limit: 3 });
|
|
185
|
+
const pitfalls = ctx.repo.searchPitfalls(targetUrl, { limit: 4 });
|
|
186
|
+
const lines = [
|
|
187
|
+
`# 🛰️ DocOrbit: Documentation Ingested Successfully`,
|
|
188
|
+
`> **Target**: \`${targetUrl}\` | **Snapshot**: \`${snapshotId}\` | **Duration**: ${durationMs}ms`,
|
|
189
|
+
``,
|
|
190
|
+
`### Ingestion Statistics`,
|
|
191
|
+
`- **Pages Ingested**: ${pagesCount}`,
|
|
192
|
+
`- **Chunks Indexed**: ${chunksCount}`,
|
|
193
|
+
`- **Code Examples Indexed**: ${codeExamplesCount}`,
|
|
194
|
+
`- **Total Estimated Tokens**: ~${estimatedTokens}`,
|
|
195
|
+
``,
|
|
196
|
+
`### Ingested Pages Directory`,
|
|
197
|
+
];
|
|
198
|
+
for (let i = 0; i < pagesSummary.length; i++) {
|
|
199
|
+
const p = pagesSummary[i];
|
|
200
|
+
lines.push(`${i + 1}. **${p.title}** - \`${p.url}\` (~${p.tokens} tokens, ${p.codeBlocks} code snippets)`);
|
|
201
|
+
}
|
|
202
|
+
if (apiEndpoints.length > 0) {
|
|
203
|
+
lines.push(``, `### Discovered API Endpoints`);
|
|
204
|
+
for (const ep of apiEndpoints) {
|
|
205
|
+
lines.push(`- **\`${ep.method.toUpperCase()} ${ep.path}\`**: ${ep.summary || ep.description || 'No description'}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (codeExamples.length > 0) {
|
|
209
|
+
lines.push(``, `### Extracted Code Patterns`);
|
|
210
|
+
for (const ex of codeExamples) {
|
|
211
|
+
lines.push(`#### ${ex.task} (${ex.language}${ex.framework ? `, ${ex.framework}` : ''})`);
|
|
212
|
+
lines.push('```' + ex.language);
|
|
213
|
+
lines.push(ex.code);
|
|
214
|
+
lines.push('```\n');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (pitfalls.length > 0) {
|
|
218
|
+
lines.push(``, `### Pitfalls & Deprecation Notices`);
|
|
219
|
+
for (const pf of pitfalls) {
|
|
220
|
+
lines.push(`- ⚠️ **[${pf.kind.toUpperCase()}] ${pf.title}**: ${pf.content}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
lines.push(``, `### Recommended Agent Loop Actions`, `- **Compile Recipe**: Call \`get_implementation_context(task: "...")\` to assemble a grounded blueprint with ordered steps and validation criteria.`, `- **Inspect Endpoints**: Call \`find_api(query: "...")\` for parameters, auth, schemas, and error responses.`, `- **Code Examples**: Call \`find_example(task: "...")\` for targeted snippets matching your framework.`, `- **Check Constraints**: Call \`find_pitfall(query: "...")\` to avoid deprecations or runtime traps.`);
|
|
224
|
+
return {
|
|
225
|
+
content: [
|
|
226
|
+
{
|
|
227
|
+
type: 'text',
|
|
228
|
+
text: JSON.stringify({
|
|
229
|
+
markdown: lines.join('\n'),
|
|
230
|
+
data: {
|
|
231
|
+
targetUrl,
|
|
232
|
+
snapshotId,
|
|
233
|
+
stats: {
|
|
234
|
+
pagesCount,
|
|
235
|
+
chunksCount,
|
|
236
|
+
codeExamplesCount,
|
|
237
|
+
estimatedTokens,
|
|
238
|
+
durationMs,
|
|
239
|
+
},
|
|
240
|
+
pages: pagesSummary,
|
|
241
|
+
apiEndpoints,
|
|
242
|
+
codeExamples,
|
|
243
|
+
pitfalls,
|
|
244
|
+
},
|
|
245
|
+
}, null, 2),
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
return {
|
|
252
|
+
isError: true,
|
|
253
|
+
content: [
|
|
254
|
+
{
|
|
255
|
+
type: 'text',
|
|
256
|
+
text: JSON.stringify({
|
|
257
|
+
error: `DocOrbit Ingestion Failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
258
|
+
}),
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CallToolResult, McpTool } from '../types.ts';
|
|
2
|
+
import type { McpContext, McpToolHandler } from './types.ts';
|
|
3
|
+
export declare class ListSourcesTool implements McpToolHandler {
|
|
4
|
+
readonly definition: McpTool;
|
|
5
|
+
execute(args: Record<string, unknown>, ctx: McpContext): Promise<CallToolResult>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export class ListSourcesTool {
|
|
2
|
+
definition = {
|
|
3
|
+
name: 'list_sources',
|
|
4
|
+
description: 'List all indexed documentation sources, snapshot records, doc versions, and machine-readability status.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
limit: {
|
|
9
|
+
type: 'number',
|
|
10
|
+
description: 'Maximum number of sources to list (default: 50).',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
async execute(args, ctx) {
|
|
16
|
+
const limit = typeof args.limit === 'number' && args.limit > 0 ? args.limit : 50;
|
|
17
|
+
const sources = ctx.repo.listSources().slice(0, limit);
|
|
18
|
+
const snapshots = ctx.repo.listSnapshots();
|
|
19
|
+
if (sources.length === 0) {
|
|
20
|
+
return {
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: JSON.stringify({
|
|
25
|
+
markdown: '### Indexed Documentation Sources\n\nNo documentation sources have been added yet. Use `docorbit add <url>` to ingest documentation.',
|
|
26
|
+
data: { count: 0, sources: [] },
|
|
27
|
+
}, null, 2),
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const formatted = sources.map(s => {
|
|
33
|
+
const sourceSnaps = snapshots.filter(sn => sn.sourceId === s.id);
|
|
34
|
+
return {
|
|
35
|
+
id: s.id,
|
|
36
|
+
url: s.url,
|
|
37
|
+
type: s.type,
|
|
38
|
+
status: s.status,
|
|
39
|
+
authority: s.authority,
|
|
40
|
+
confidence: s.confidence,
|
|
41
|
+
machineReadable: s.machineReadable,
|
|
42
|
+
snapshots: sourceSnaps.map(sn => ({
|
|
43
|
+
id: sn.id,
|
|
44
|
+
pageCount: sn.pageCount,
|
|
45
|
+
docVersion: sn.docVersion,
|
|
46
|
+
capturedAt: sn.capturedAt,
|
|
47
|
+
})),
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const lines = [`### Indexed Documentation Sources (${sources.length} sources)\n`];
|
|
51
|
+
for (const s of formatted) {
|
|
52
|
+
const icon = s.status === 'valid' ? '✓' : '✗';
|
|
53
|
+
lines.push(`- **${icon} [${s.type}]** ${s.url}`);
|
|
54
|
+
lines.push(` *Authority*: ${s.authority} | *Confidence*: ${Math.round(s.confidence * 100)}% | *Machine-Readable*: ${s.machineReadable}`);
|
|
55
|
+
if (s.snapshots.length > 0) {
|
|
56
|
+
const snapInfo = s.snapshots.map(sn => `${sn.id}${sn.docVersion ? ` (${sn.docVersion})` : ''} [${sn.pageCount} pages]`).join(', ');
|
|
57
|
+
lines.push(` *Snapshots*: ${snapInfo}`);
|
|
58
|
+
}
|
|
59
|
+
lines.push('');
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
content: [
|
|
63
|
+
{
|
|
64
|
+
type: 'text',
|
|
65
|
+
text: JSON.stringify({
|
|
66
|
+
markdown: lines.join('\n'),
|
|
67
|
+
data: {
|
|
68
|
+
count: formatted.length,
|
|
69
|
+
sources: formatted,
|
|
70
|
+
},
|
|
71
|
+
}, null, 2),
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CallToolResult, McpTool } from '../types.ts';
|
|
2
|
+
import type { McpContext, McpToolHandler } from './types.ts';
|
|
3
|
+
export declare class SearchDocsTool implements McpToolHandler {
|
|
4
|
+
readonly definition: McpTool;
|
|
5
|
+
execute(args: Record<string, unknown>, ctx: McpContext): Promise<CallToolResult>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { RetrievalEngine } from "../../../retrieval/src/index.js";
|
|
2
|
+
export class SearchDocsTool {
|
|
3
|
+
definition = {
|
|
4
|
+
name: 'search_docs',
|
|
5
|
+
description: 'Search documentation chunks using hybrid FTS5 ranking, symbol awareness, and optional version filtering.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
query: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: 'The search query, code symbol, or concept to look for.',
|
|
12
|
+
},
|
|
13
|
+
library: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Optional library name to narrow search scope.',
|
|
16
|
+
},
|
|
17
|
+
version: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Target documentation version (e.g. "v14", "15.0").',
|
|
20
|
+
},
|
|
21
|
+
limit: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
description: 'Maximum number of results to return (default: 10).',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: ['query'],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
async execute(args, ctx) {
|
|
30
|
+
const query = typeof args.query === 'string' ? args.query.trim() : '';
|
|
31
|
+
if (!query) {
|
|
32
|
+
return {
|
|
33
|
+
isError: true,
|
|
34
|
+
content: [{ type: 'text', text: JSON.stringify({ error: 'Missing required parameter: query' }) }],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const version = typeof args.docVersion === 'string'
|
|
38
|
+
? args.docVersion
|
|
39
|
+
: (typeof args.version === 'string' ? args.version : undefined);
|
|
40
|
+
const limit = typeof args.limit === 'number' && args.limit > 0 ? args.limit : 10;
|
|
41
|
+
const engine = new RetrievalEngine(ctx.repo);
|
|
42
|
+
const results = await engine.search(query, {
|
|
43
|
+
docVersion: version,
|
|
44
|
+
limit,
|
|
45
|
+
projectDir: ctx.workspaceRoot,
|
|
46
|
+
});
|
|
47
|
+
if (results.length === 0) {
|
|
48
|
+
const emptyPayload = {
|
|
49
|
+
query,
|
|
50
|
+
count: 0,
|
|
51
|
+
results: [],
|
|
52
|
+
message: `No documentation chunks found matching "${query}". Try refining terms or checking available sources.`,
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: JSON.stringify({
|
|
59
|
+
markdown: `### Search Results for "${query}"\n\nNo matching documentation found.`,
|
|
60
|
+
data: emptyPayload,
|
|
61
|
+
}, null, 2),
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const formattedChunks = results.map(r => ({
|
|
67
|
+
id: r.chunk.id,
|
|
68
|
+
chunk: r.chunk,
|
|
69
|
+
title: r.chunk.title || 'Untitled Section',
|
|
70
|
+
sectionPath: r.chunk.sectionPath,
|
|
71
|
+
content: r.chunk.content,
|
|
72
|
+
chunkType: r.chunk.chunkType,
|
|
73
|
+
language: r.chunk.language,
|
|
74
|
+
tokenEstimate: r.chunk.tokenEstimate,
|
|
75
|
+
docVersion: r.chunk.docVersion,
|
|
76
|
+
score: r.score,
|
|
77
|
+
symbols: r.symbols.map(s => s.name),
|
|
78
|
+
provenance: r.chunk.provenance ? {
|
|
79
|
+
sourceUrl: r.chunk.provenance.sourceUrl,
|
|
80
|
+
fetchedAt: r.chunk.provenance.fetchedAt,
|
|
81
|
+
untrusted: true,
|
|
82
|
+
} : undefined,
|
|
83
|
+
}));
|
|
84
|
+
const lines = [
|
|
85
|
+
`### Search Results for "${query}" (${results.length} found)`,
|
|
86
|
+
`> [!NOTE] External documentation content is untrusted.\n`,
|
|
87
|
+
];
|
|
88
|
+
for (let i = 0; i < formattedChunks.length; i++) {
|
|
89
|
+
const c = formattedChunks[i];
|
|
90
|
+
const path = c.sectionPath.length > 0 ? c.sectionPath.join(' > ') : c.title;
|
|
91
|
+
lines.push(`${i + 1}. **${path}** [${c.chunkType}] (score: ${c.score})`);
|
|
92
|
+
lines.push(` *ID*: \`${c.id}\`${c.docVersion ? ` | *Version*: \`${c.docVersion}\`` : ''}`);
|
|
93
|
+
if (c.symbols.length > 0)
|
|
94
|
+
lines.push(` *Symbols*: ${c.symbols.join(', ')}`);
|
|
95
|
+
lines.push(` \`\`\`\n ${c.content.split('\n').slice(0, 5).join('\n ')}\n \`\`\`\n`);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
content: [
|
|
99
|
+
{
|
|
100
|
+
type: 'text',
|
|
101
|
+
text: JSON.stringify({
|
|
102
|
+
markdown: lines.join('\n'),
|
|
103
|
+
data: {
|
|
104
|
+
query,
|
|
105
|
+
count: results.length,
|
|
106
|
+
results: formattedChunks,
|
|
107
|
+
},
|
|
108
|
+
}, null, 2),
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DocOrbitRepository } from '../../../storage/src/index.ts';
|
|
2
|
+
import type { ImplementationContextService } from '../../../core/src/index.ts';
|
|
3
|
+
import type { WorkspaceResolver } from '../../../workspace/src/index.ts';
|
|
4
|
+
import type { VerificationService, DiffService, ImpactAnalysisService } from '../../../verification/src/index.ts';
|
|
5
|
+
import type { ExportService } from '../../../export/src/index.ts';
|
|
6
|
+
import type { CallToolResult, McpTool } from '../types.ts';
|
|
7
|
+
export interface McpContext {
|
|
8
|
+
repo: DocOrbitRepository;
|
|
9
|
+
implService: ImplementationContextService;
|
|
10
|
+
implementationService: ImplementationContextService;
|
|
11
|
+
workspaceRoot?: string;
|
|
12
|
+
projectDir?: string;
|
|
13
|
+
resolver?: WorkspaceResolver;
|
|
14
|
+
verificationService?: VerificationService;
|
|
15
|
+
diffService?: DiffService;
|
|
16
|
+
impactService?: ImpactAnalysisService;
|
|
17
|
+
exportService?: ExportService;
|
|
18
|
+
}
|
|
19
|
+
export interface McpToolHandler {
|
|
20
|
+
readonly definition: McpTool;
|
|
21
|
+
execute(args: Record<string, unknown>, ctx: McpContext): Promise<CallToolResult>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|