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,376 @@
|
|
|
1
|
+
import { runInspectCommand } from "./commands/inspect.js";
|
|
2
|
+
import { runAddCommand } from "./commands/add.js";
|
|
3
|
+
import { runSearchCommand } from "./commands/search.js";
|
|
4
|
+
import { runContextCommand } from "./commands/context.js";
|
|
5
|
+
import { runInitCommand } from "./commands/init.js";
|
|
6
|
+
import { runUpdateCommand } from "./commands/update.js";
|
|
7
|
+
import { runApiCommand } from "./commands/api.js";
|
|
8
|
+
import { runExamplesCommand } from "./commands/examples.js";
|
|
9
|
+
import { runPitfallsCommand } from "./commands/pitfalls.js";
|
|
10
|
+
import { runRecipesCommand } from "./commands/recipes.js";
|
|
11
|
+
import { runMcpCommand } from "./commands/mcp.js";
|
|
12
|
+
import { runVerifyCommand } from "./commands/verify.js";
|
|
13
|
+
import { runDiffCommand } from "./commands/diff.js";
|
|
14
|
+
import { runImpactCommand } from "./commands/impact.js";
|
|
15
|
+
import { runDashboardCommand } from "./commands/dashboard.js";
|
|
16
|
+
import { runExportCommand } from "./commands/export.js";
|
|
17
|
+
import { handleEvaluateCommand } from "./commands/evaluate.js";
|
|
18
|
+
const VERSION = '0.1.1';
|
|
19
|
+
function printHelp() {
|
|
20
|
+
console.log(`
|
|
21
|
+
DocOrbit — The Documentation Intelligence Layer for Coding Agents
|
|
22
|
+
Version: ${VERSION}
|
|
23
|
+
|
|
24
|
+
USAGE:
|
|
25
|
+
docorbit <command> [options]
|
|
26
|
+
|
|
27
|
+
COMMANDS:
|
|
28
|
+
init [dir] Scan workspace, detect project dependencies, resolve docs, and write docs.lock
|
|
29
|
+
update [pkg] Update docs.lock dependencies (selective or global refresh)
|
|
30
|
+
inspect <url> Probe target documentation domain for canonical machine-readable sources
|
|
31
|
+
add <url> Discover, rank, fetch, normalize, slice, and store documentation into local SQLite
|
|
32
|
+
search "<query>" Deterministic hybrid search across sliced documentation chunks
|
|
33
|
+
context "<task>" Pack relevant documentation context optimized for AI coding agent tasks
|
|
34
|
+
api "<query>" Search and inspect structured API endpoints (OpenAPI / Swagger)
|
|
35
|
+
examples "<task>" Search and filter first-class code examples by language, framework, or task
|
|
36
|
+
pitfalls "<task>" Search explicit warnings, deprecations, breaking changes, and runtime restrictions
|
|
37
|
+
recipes "<goal>" Deterministically compile evidence-grounded implementation recipes
|
|
38
|
+
verify <code/file>Verify agent code against indexed schemas and detect mismatches/deprecations
|
|
39
|
+
diff [source] Compare documentation versions and snapshots (detect added/removed/deprecated APIs)
|
|
40
|
+
impact [source] Analyze impact of doc changes on project workspace files
|
|
41
|
+
dashboard Launch local zero-dependency web inspection UI and verification playground (alias: ui)
|
|
42
|
+
export [format] Deterministically export agent guidance files (AGENTS.md, CLAUDE.md, skill.md, llms.txt, docs-map.md)
|
|
43
|
+
eval Run empirical comparative evaluation benchmark (DocOrbit vs Context7 vs Official Docs Fetch vs Firecrawl)
|
|
44
|
+
mcp Start agent-native Model Context Protocol (MCP) server (stdio / streamable HTTP)
|
|
45
|
+
|
|
46
|
+
OPTIONS:
|
|
47
|
+
--project <dir> Workspace root for project-aware dependency detection (default: current dir)
|
|
48
|
+
--doc-version <v> Target documentation version filter/boost (e.g. v14, 15.0)
|
|
49
|
+
--from <v> Base version for documentation diffing / impact analysis (e.g. v14)
|
|
50
|
+
--to <v> Target version for documentation diffing / impact analysis (e.g. v15)
|
|
51
|
+
--library <lib> Filter or target specific library (e.g. stripe, next)
|
|
52
|
+
--format <fmt> Export format: agents.md, claude.md, skill.md, llms.txt, docs-map.md
|
|
53
|
+
--output <path> Custom output file path for export command
|
|
54
|
+
--stdout Print exported agent content directly to stdout
|
|
55
|
+
--json Output results as structured JSON
|
|
56
|
+
--db <path> Custom SQLite database path (default: .docorbit/docorbit.db)
|
|
57
|
+
--tokens <num> Token budget for context packaging (default: 3000)
|
|
58
|
+
--limit <num> Maximum search results to return (default: 10)
|
|
59
|
+
--type <type> Filter by chunk type: prose, code, api, warning, example, mixed
|
|
60
|
+
--method <method> Filter API endpoints by HTTP method: get, post, put, delete, patch
|
|
61
|
+
--language <lang> Filter code examples by language: typescript, python, go, rust, bash
|
|
62
|
+
--framework <fw> Filter code examples by framework: next, react, express, fastapi, flask
|
|
63
|
+
--kind <kind> Filter pitfalls by kind: deprecated, removed, breaking_change, server_only, rate_limit, security
|
|
64
|
+
--stdio Run MCP server over standard I/O (stdin/stdout) (default)
|
|
65
|
+
--port <num> Port for HTTP server or dashboard (default: 3737 for dashboard)
|
|
66
|
+
--host <ip> Host to bind HTTP transport / dashboard (default: 127.0.0.1)
|
|
67
|
+
--max-pages <num> Maximum pages to crawl and ingest (default: 50)
|
|
68
|
+
--allow-localhost Allow localhost / loopback targets (useful for local development & testing)
|
|
69
|
+
-h, --help Show this help message
|
|
70
|
+
-v, --version Show DocOrbit version
|
|
71
|
+
|
|
72
|
+
EXAMPLES:
|
|
73
|
+
docorbit init .
|
|
74
|
+
docorbit verify "fetch('/v1/charges', { method: 'POST' })" --doc-version v14
|
|
75
|
+
docorbit diff --from v14 --to v15
|
|
76
|
+
docorbit impact --from v14 --to v15 --project .
|
|
77
|
+
docorbit mcp --stdio
|
|
78
|
+
docorbit api "create subscription" --doc-version v1
|
|
79
|
+
docorbit examples "verify webhook signature" --language typescript --framework express
|
|
80
|
+
docorbit pitfalls "server actions" --kind server_only --doc-version v14
|
|
81
|
+
docorbit recipes "Handle webhook signature verification in Next.js" --project .
|
|
82
|
+
`);
|
|
83
|
+
}
|
|
84
|
+
export async function main(args = process.argv.slice(2)) {
|
|
85
|
+
if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
|
|
86
|
+
printHelp();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (args.includes('-v') || args.includes('--version')) {
|
|
90
|
+
console.log(`DocOrbit v${VERSION}`);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const command = args[0];
|
|
94
|
+
const queryArg = args[1]?.startsWith('-') ? undefined : args[1];
|
|
95
|
+
const isJson = args.includes('--json');
|
|
96
|
+
const allowLocalhost = args.includes('--allow-localhost');
|
|
97
|
+
let dbPath;
|
|
98
|
+
const dbIdx = args.indexOf('--db');
|
|
99
|
+
if (dbIdx !== -1 && args[dbIdx + 1]) {
|
|
100
|
+
dbPath = args[dbIdx + 1];
|
|
101
|
+
}
|
|
102
|
+
let projectDir;
|
|
103
|
+
const projIdx = args.indexOf('--project');
|
|
104
|
+
if (projIdx !== -1 && args[projIdx + 1]) {
|
|
105
|
+
projectDir = args[projIdx + 1];
|
|
106
|
+
}
|
|
107
|
+
let docVersion;
|
|
108
|
+
const docVerIdx = args.indexOf('--doc-version');
|
|
109
|
+
if (docVerIdx !== -1 && args[docVerIdx + 1]) {
|
|
110
|
+
docVersion = args[docVerIdx + 1];
|
|
111
|
+
}
|
|
112
|
+
let maxPages;
|
|
113
|
+
const maxPagesIdx = args.indexOf('--max-pages');
|
|
114
|
+
if (maxPagesIdx !== -1 && args[maxPagesIdx + 1]) {
|
|
115
|
+
maxPages = parseInt(args[maxPagesIdx + 1], 10);
|
|
116
|
+
}
|
|
117
|
+
let limit;
|
|
118
|
+
const limitIdx = args.indexOf('--limit');
|
|
119
|
+
if (limitIdx !== -1 && args[limitIdx + 1]) {
|
|
120
|
+
limit = parseInt(args[limitIdx + 1], 10);
|
|
121
|
+
}
|
|
122
|
+
let tokens;
|
|
123
|
+
const tokensIdx = args.indexOf('--tokens');
|
|
124
|
+
if (tokensIdx !== -1 && args[tokensIdx + 1]) {
|
|
125
|
+
tokens = parseInt(args[tokensIdx + 1], 10);
|
|
126
|
+
}
|
|
127
|
+
let chunkType;
|
|
128
|
+
const typeIdx = args.indexOf('--type');
|
|
129
|
+
if (typeIdx !== -1 && args[typeIdx + 1]) {
|
|
130
|
+
chunkType = args[typeIdx + 1];
|
|
131
|
+
}
|
|
132
|
+
let method;
|
|
133
|
+
const methodIdx = args.indexOf('--method');
|
|
134
|
+
if (methodIdx !== -1 && args[methodIdx + 1]) {
|
|
135
|
+
method = args[methodIdx + 1];
|
|
136
|
+
}
|
|
137
|
+
let language;
|
|
138
|
+
const langIdx = args.indexOf('--language');
|
|
139
|
+
if (langIdx !== -1 && args[langIdx + 1]) {
|
|
140
|
+
language = args[langIdx + 1];
|
|
141
|
+
}
|
|
142
|
+
let framework;
|
|
143
|
+
const fwIdx = args.indexOf('--framework');
|
|
144
|
+
if (fwIdx !== -1 && args[fwIdx + 1]) {
|
|
145
|
+
framework = args[fwIdx + 1];
|
|
146
|
+
}
|
|
147
|
+
let kind;
|
|
148
|
+
const kindIdx = args.indexOf('--kind');
|
|
149
|
+
if (kindIdx !== -1 && args[kindIdx + 1]) {
|
|
150
|
+
kind = args[kindIdx + 1];
|
|
151
|
+
}
|
|
152
|
+
const isStdio = args.includes('--stdio');
|
|
153
|
+
let port;
|
|
154
|
+
const portIdx = args.indexOf('--port');
|
|
155
|
+
if (portIdx !== -1 && args[portIdx + 1]) {
|
|
156
|
+
port = parseInt(args[portIdx + 1], 10);
|
|
157
|
+
}
|
|
158
|
+
let host;
|
|
159
|
+
const hostIdx = args.indexOf('--host');
|
|
160
|
+
if (hostIdx !== -1 && args[hostIdx + 1]) {
|
|
161
|
+
host = args[hostIdx + 1];
|
|
162
|
+
}
|
|
163
|
+
let fromVersion;
|
|
164
|
+
const fromIdx = args.indexOf('--from');
|
|
165
|
+
if (fromIdx !== -1 && args[fromIdx + 1]) {
|
|
166
|
+
fromVersion = args[fromIdx + 1];
|
|
167
|
+
}
|
|
168
|
+
let toVersion;
|
|
169
|
+
const toIdx = args.indexOf('--to');
|
|
170
|
+
if (toIdx !== -1 && args[toIdx + 1]) {
|
|
171
|
+
toVersion = args[toIdx + 1];
|
|
172
|
+
}
|
|
173
|
+
let library;
|
|
174
|
+
const libIdx = args.indexOf('--library');
|
|
175
|
+
if (libIdx !== -1 && args[libIdx + 1]) {
|
|
176
|
+
library = args[libIdx + 1];
|
|
177
|
+
}
|
|
178
|
+
let output;
|
|
179
|
+
const outIdx = args.indexOf('--output');
|
|
180
|
+
if (outIdx !== -1 && args[outIdx + 1]) {
|
|
181
|
+
output = args[outIdx + 1];
|
|
182
|
+
}
|
|
183
|
+
let format;
|
|
184
|
+
const fmtIdx = args.indexOf('--format');
|
|
185
|
+
if (fmtIdx !== -1 && args[fmtIdx + 1]) {
|
|
186
|
+
format = args[fmtIdx + 1];
|
|
187
|
+
}
|
|
188
|
+
let targetSource;
|
|
189
|
+
const srcIdx = args.indexOf('--source');
|
|
190
|
+
if (srcIdx !== -1 && args[srcIdx + 1]) {
|
|
191
|
+
targetSource = args[srcIdx + 1];
|
|
192
|
+
}
|
|
193
|
+
let evalSplit;
|
|
194
|
+
const splitIdx = args.indexOf('--split');
|
|
195
|
+
if (splitIdx !== -1 && args[splitIdx + 1]) {
|
|
196
|
+
evalSplit = args[splitIdx + 1];
|
|
197
|
+
}
|
|
198
|
+
let evalStrategy;
|
|
199
|
+
const stratIdx = args.indexOf('--strategy');
|
|
200
|
+
if (stratIdx !== -1 && args[stratIdx + 1]) {
|
|
201
|
+
evalStrategy = args[stratIdx + 1];
|
|
202
|
+
}
|
|
203
|
+
let evalTask;
|
|
204
|
+
const taskIdx = args.indexOf('--task');
|
|
205
|
+
if (taskIdx !== -1 && args[taskIdx + 1]) {
|
|
206
|
+
evalTask = args[taskIdx + 1];
|
|
207
|
+
}
|
|
208
|
+
const isStdout = args.includes('--stdout');
|
|
209
|
+
const noOpen = args.includes('--no-open');
|
|
210
|
+
const isVerbose = args.includes('--verbose');
|
|
211
|
+
switch (command) {
|
|
212
|
+
case 'init': {
|
|
213
|
+
const targetDir = queryArg || projectDir || '.';
|
|
214
|
+
await runInitCommand(targetDir, { json: isJson, dbPath });
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case 'update': {
|
|
218
|
+
const targetPkg = queryArg;
|
|
219
|
+
await runUpdateCommand(targetPkg, { json: isJson, dbPath, projectDir });
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
case 'inspect': {
|
|
223
|
+
if (!queryArg) {
|
|
224
|
+
console.error('Error: "inspect" requires a target URL argument.');
|
|
225
|
+
printHelp();
|
|
226
|
+
process.exit(1);
|
|
227
|
+
}
|
|
228
|
+
await runInspectCommand(queryArg, { json: isJson, allowLocalhost });
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
case 'add': {
|
|
232
|
+
if (!queryArg) {
|
|
233
|
+
console.error('Error: "add" requires a target URL argument.');
|
|
234
|
+
printHelp();
|
|
235
|
+
process.exit(1);
|
|
236
|
+
}
|
|
237
|
+
await runAddCommand(queryArg, { json: isJson, dbPath, maxPages, allowLocalhost });
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
case 'search': {
|
|
241
|
+
if (!queryArg) {
|
|
242
|
+
console.error('Error: "search" requires a query string argument.');
|
|
243
|
+
printHelp();
|
|
244
|
+
process.exit(1);
|
|
245
|
+
}
|
|
246
|
+
await runSearchCommand(queryArg, { json: isJson, dbPath, limit, chunkType, docVersion, projectDir });
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
case 'context': {
|
|
250
|
+
if (!queryArg) {
|
|
251
|
+
console.error('Error: "context" requires a task description argument.');
|
|
252
|
+
printHelp();
|
|
253
|
+
process.exit(1);
|
|
254
|
+
}
|
|
255
|
+
await runContextCommand(queryArg, { json: isJson, dbPath, tokens, docVersion, projectDir });
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
case 'api': {
|
|
259
|
+
await runApiCommand(queryArg || '', { method, docVersion, projectDir, limit, json: isJson, dbPath });
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
case 'examples': {
|
|
263
|
+
await runExamplesCommand(queryArg || '', { language, framework, docVersion, projectDir, limit, json: isJson, dbPath });
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
case 'pitfalls': {
|
|
267
|
+
await runPitfallsCommand(queryArg || '', { kind, docVersion, projectDir, limit, json: isJson, dbPath });
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
case 'recipes': {
|
|
271
|
+
if (!queryArg) {
|
|
272
|
+
console.error('Error: "recipes" requires an implementation goal argument.');
|
|
273
|
+
printHelp();
|
|
274
|
+
process.exit(1);
|
|
275
|
+
}
|
|
276
|
+
await runRecipesCommand(queryArg, { docVersion, projectDir, json: isJson, dbPath });
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case 'mcp': {
|
|
280
|
+
await runMcpCommand({
|
|
281
|
+
stdio: isStdio || !port,
|
|
282
|
+
port,
|
|
283
|
+
host,
|
|
284
|
+
dbPath,
|
|
285
|
+
projectDir,
|
|
286
|
+
});
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case 'verify':
|
|
290
|
+
case 'check-api': {
|
|
291
|
+
if (!queryArg) {
|
|
292
|
+
console.error('Error: "verify" requires a code snippet or file path argument.');
|
|
293
|
+
printHelp();
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
await runVerifyCommand(queryArg, {
|
|
297
|
+
docVersion,
|
|
298
|
+
projectDir,
|
|
299
|
+
library,
|
|
300
|
+
language,
|
|
301
|
+
json: isJson,
|
|
302
|
+
dbPath,
|
|
303
|
+
});
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
case 'diff': {
|
|
307
|
+
await runDiffCommand(queryArg || '', {
|
|
308
|
+
from: fromVersion,
|
|
309
|
+
to: toVersion,
|
|
310
|
+
json: isJson,
|
|
311
|
+
dbPath,
|
|
312
|
+
});
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
case 'impact': {
|
|
316
|
+
await runImpactCommand(queryArg || '', {
|
|
317
|
+
from: fromVersion,
|
|
318
|
+
to: toVersion,
|
|
319
|
+
projectDir,
|
|
320
|
+
json: isJson,
|
|
321
|
+
dbPath,
|
|
322
|
+
});
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
case 'dashboard':
|
|
326
|
+
case 'ui': {
|
|
327
|
+
await runDashboardCommand({
|
|
328
|
+
port,
|
|
329
|
+
host,
|
|
330
|
+
projectDir,
|
|
331
|
+
dbPath,
|
|
332
|
+
noOpen,
|
|
333
|
+
});
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
case 'export': {
|
|
337
|
+
await runExportCommand(queryArg || format, {
|
|
338
|
+
format,
|
|
339
|
+
output,
|
|
340
|
+
stdout: isStdout,
|
|
341
|
+
projectDir,
|
|
342
|
+
docVersion,
|
|
343
|
+
targetSource,
|
|
344
|
+
json: isJson,
|
|
345
|
+
dbPath,
|
|
346
|
+
});
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
case 'eval':
|
|
350
|
+
case 'evaluate':
|
|
351
|
+
case 'benchmark': {
|
|
352
|
+
await handleEvaluateCommand({
|
|
353
|
+
split: evalSplit,
|
|
354
|
+
strategy: evalStrategy,
|
|
355
|
+
task: evalTask,
|
|
356
|
+
output,
|
|
357
|
+
json: isJson,
|
|
358
|
+
verbose: isVerbose,
|
|
359
|
+
simulation: args.includes('--simulation'),
|
|
360
|
+
});
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
default: {
|
|
364
|
+
console.error(`Unknown command: "${command}"\n`);
|
|
365
|
+
printHelp();
|
|
366
|
+
process.exit(1);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// Direct CLI invocation
|
|
371
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
372
|
+
main().catch(err => {
|
|
373
|
+
console.error('Fatal DocOrbit Error:', err);
|
|
374
|
+
process.exit(1);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
import type { DocOrbitRepository } from '../../../storage/src/index.ts';
|
|
3
|
+
export interface DashboardServerOptions {
|
|
4
|
+
repo: DocOrbitRepository;
|
|
5
|
+
projectDir?: string;
|
|
6
|
+
dbPath?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class DashboardServer {
|
|
9
|
+
private repo;
|
|
10
|
+
private projectDir?;
|
|
11
|
+
private dbPath;
|
|
12
|
+
private exportService;
|
|
13
|
+
private verificationService;
|
|
14
|
+
private diffService;
|
|
15
|
+
private impactService;
|
|
16
|
+
private server;
|
|
17
|
+
constructor(options: DashboardServerOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Starts the local dashboard HTTP server.
|
|
20
|
+
*/
|
|
21
|
+
start(port?: number, host?: string): Promise<{
|
|
22
|
+
server: http.Server;
|
|
23
|
+
url: string;
|
|
24
|
+
port: number;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Stops the server gracefully.
|
|
28
|
+
*/
|
|
29
|
+
stop(): Promise<void>;
|
|
30
|
+
handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
31
|
+
private getStats;
|
|
32
|
+
private readJsonBody;
|
|
33
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
import { URL } from 'node:url';
|
|
3
|
+
import { ExportService } from "../../../export/src/index.js";
|
|
4
|
+
import { VerificationService, DiffService, ImpactAnalysisService, } from "../../../verification/src/index.js";
|
|
5
|
+
import { renderDashboardHtml } from "./ui.js";
|
|
6
|
+
export class DashboardServer {
|
|
7
|
+
repo;
|
|
8
|
+
projectDir;
|
|
9
|
+
dbPath;
|
|
10
|
+
exportService;
|
|
11
|
+
verificationService;
|
|
12
|
+
diffService;
|
|
13
|
+
impactService;
|
|
14
|
+
server = null;
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.repo = options.repo;
|
|
17
|
+
this.projectDir = options.projectDir;
|
|
18
|
+
this.dbPath = options.dbPath || '.docorbit/docorbit.db';
|
|
19
|
+
this.exportService = new ExportService(this.repo);
|
|
20
|
+
this.verificationService = new VerificationService(this.repo);
|
|
21
|
+
this.diffService = new DiffService(this.repo);
|
|
22
|
+
this.impactService = new ImpactAnalysisService(this.repo);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Starts the local dashboard HTTP server.
|
|
26
|
+
*/
|
|
27
|
+
start(port = 3737, host = '127.0.0.1') {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
this.server = http.createServer(async (req, res) => {
|
|
30
|
+
try {
|
|
31
|
+
await this.handleRequest(req, res);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
35
|
+
res.end(JSON.stringify({ error: err.message || 'Internal Server Error' }));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
this.server.on('error', (err) => {
|
|
39
|
+
reject(err);
|
|
40
|
+
});
|
|
41
|
+
this.server.listen(port, host, () => {
|
|
42
|
+
const address = this.server.address();
|
|
43
|
+
const actualPort = address.port;
|
|
44
|
+
const url = `http://${host}:${actualPort}/`;
|
|
45
|
+
resolve({ server: this.server, url, port: actualPort });
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Stops the server gracefully.
|
|
51
|
+
*/
|
|
52
|
+
stop() {
|
|
53
|
+
return new Promise((resolve) => {
|
|
54
|
+
if (this.server) {
|
|
55
|
+
this.server.close(() => {
|
|
56
|
+
this.server = null;
|
|
57
|
+
resolve();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
resolve();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async handleRequest(req, res) {
|
|
66
|
+
const parsedUrl = new URL(req.url || '/', `http://${req.headers.host || '127.0.0.1'}`);
|
|
67
|
+
const pathname = parsedUrl.pathname;
|
|
68
|
+
const method = (req.method || 'GET').toUpperCase();
|
|
69
|
+
// CORS for local development
|
|
70
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
71
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
72
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
73
|
+
if (method === 'OPTIONS') {
|
|
74
|
+
res.writeHead(204);
|
|
75
|
+
res.end();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Root UI
|
|
79
|
+
if (pathname === '/' || pathname === '/index.html') {
|
|
80
|
+
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
81
|
+
res.end(renderDashboardHtml());
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// JSON REST API
|
|
85
|
+
if (pathname.startsWith('/api/')) {
|
|
86
|
+
res.setHeader('Content-Type', 'application/json; charset=utf-8');
|
|
87
|
+
if (pathname === '/api/stats' && method === 'GET') {
|
|
88
|
+
const stats = this.getStats();
|
|
89
|
+
res.writeHead(200);
|
|
90
|
+
res.end(JSON.stringify(stats));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (pathname === '/api/sources' && method === 'GET') {
|
|
94
|
+
const sources = this.repo.sources.listSources();
|
|
95
|
+
res.writeHead(200);
|
|
96
|
+
res.end(JSON.stringify(sources));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (pathname === '/api/pages' && method === 'GET') {
|
|
100
|
+
const pages = this.repo.pages.listPages(200);
|
|
101
|
+
res.writeHead(200);
|
|
102
|
+
res.end(JSON.stringify(pages));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (pathname === '/api/apis' && method === 'GET') {
|
|
106
|
+
const q = parsedUrl.searchParams.get('q') || '';
|
|
107
|
+
const apiMethod = parsedUrl.searchParams.get('method') || undefined;
|
|
108
|
+
const docVersion = parsedUrl.searchParams.get('docVersion') || undefined;
|
|
109
|
+
const apis = this.repo.apis.searchApiEndpoints(q, {
|
|
110
|
+
method: apiMethod,
|
|
111
|
+
docVersion,
|
|
112
|
+
limit: 100,
|
|
113
|
+
});
|
|
114
|
+
res.writeHead(200);
|
|
115
|
+
res.end(JSON.stringify(apis));
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (pathname === '/api/pitfalls' && method === 'GET') {
|
|
119
|
+
const q = parsedUrl.searchParams.get('q') || '';
|
|
120
|
+
const kind = parsedUrl.searchParams.get('kind') || undefined;
|
|
121
|
+
const docVersion = parsedUrl.searchParams.get('docVersion') || undefined;
|
|
122
|
+
const pitfalls = this.repo.pitfalls.searchPitfalls(q, {
|
|
123
|
+
kind,
|
|
124
|
+
docVersion,
|
|
125
|
+
limit: 100,
|
|
126
|
+
});
|
|
127
|
+
res.writeHead(200);
|
|
128
|
+
res.end(JSON.stringify(pitfalls));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (pathname === '/api/examples' && method === 'GET') {
|
|
132
|
+
const q = parsedUrl.searchParams.get('q') || '';
|
|
133
|
+
const language = parsedUrl.searchParams.get('language') || undefined;
|
|
134
|
+
const framework = parsedUrl.searchParams.get('framework') || undefined;
|
|
135
|
+
const docVersion = parsedUrl.searchParams.get('docVersion') || undefined;
|
|
136
|
+
const examples = this.repo.examples.searchIndexedExamples(q, {
|
|
137
|
+
language,
|
|
138
|
+
framework,
|
|
139
|
+
docVersion,
|
|
140
|
+
limit: 50,
|
|
141
|
+
});
|
|
142
|
+
res.writeHead(200);
|
|
143
|
+
res.end(JSON.stringify(examples));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (pathname === '/api/docs-map' && method === 'GET') {
|
|
147
|
+
const sourceId = parsedUrl.searchParams.get('sourceId') || undefined;
|
|
148
|
+
const docVersion = parsedUrl.searchParams.get('docVersion') || undefined;
|
|
149
|
+
const map = this.exportService.getDocumentationMap({ sourceId, docVersion });
|
|
150
|
+
res.writeHead(200);
|
|
151
|
+
res.end(JSON.stringify(map));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (pathname === '/api/export' && method === 'GET') {
|
|
155
|
+
const format = (parsedUrl.searchParams.get('format') || 'agents.md');
|
|
156
|
+
const docVersion = parsedUrl.searchParams.get('docVersion') || undefined;
|
|
157
|
+
const exp = await this.exportService.generateExport({
|
|
158
|
+
format,
|
|
159
|
+
docVersion,
|
|
160
|
+
projectDir: this.projectDir,
|
|
161
|
+
});
|
|
162
|
+
res.writeHead(200);
|
|
163
|
+
res.end(JSON.stringify(exp));
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (pathname === '/api/verify' && method === 'POST') {
|
|
167
|
+
const body = await this.readJsonBody(req);
|
|
168
|
+
const code = body.code || '';
|
|
169
|
+
const version = body.version || body.docVersion;
|
|
170
|
+
const library = body.library;
|
|
171
|
+
const language = body.language;
|
|
172
|
+
const verifyResult = this.verificationService.verifyCode({
|
|
173
|
+
code,
|
|
174
|
+
version,
|
|
175
|
+
library,
|
|
176
|
+
language,
|
|
177
|
+
projectDir: this.projectDir,
|
|
178
|
+
});
|
|
179
|
+
res.writeHead(200);
|
|
180
|
+
res.end(JSON.stringify(verifyResult));
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (pathname === '/api/diff' && method === 'GET') {
|
|
184
|
+
const from = parsedUrl.searchParams.get('from') || undefined;
|
|
185
|
+
const to = parsedUrl.searchParams.get('to') || undefined;
|
|
186
|
+
const source = parsedUrl.searchParams.get('source') || undefined;
|
|
187
|
+
const diffResult = this.diffService.diff({ from, to, source });
|
|
188
|
+
res.writeHead(200);
|
|
189
|
+
res.end(JSON.stringify(diffResult));
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (pathname === '/api/impact' && method === 'GET') {
|
|
193
|
+
const from = parsedUrl.searchParams.get('from') || undefined;
|
|
194
|
+
const to = parsedUrl.searchParams.get('to') || undefined;
|
|
195
|
+
const targetDir = parsedUrl.searchParams.get('projectDir') || this.projectDir || process.cwd();
|
|
196
|
+
const impactResult = this.impactService.analyzeWorkspaceImpact({
|
|
197
|
+
from,
|
|
198
|
+
to,
|
|
199
|
+
projectDir: targetDir,
|
|
200
|
+
});
|
|
201
|
+
res.writeHead(200);
|
|
202
|
+
res.end(JSON.stringify(impactResult));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
res.writeHead(404);
|
|
206
|
+
res.end(JSON.stringify({ error: `Route not found: ${pathname}` }));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
210
|
+
res.end('Not Found');
|
|
211
|
+
}
|
|
212
|
+
getStats() {
|
|
213
|
+
const sources = this.repo.sources.listSources();
|
|
214
|
+
const totalPages = this.repo.pages.countPages();
|
|
215
|
+
const totalChunks = this.repo.chunks.countChunks();
|
|
216
|
+
let totalApis = 0;
|
|
217
|
+
let totalPitfalls = 0;
|
|
218
|
+
let totalExamples = 0;
|
|
219
|
+
const activeVersions = new Set();
|
|
220
|
+
try {
|
|
221
|
+
const raw = this.repo.db.getRawDb();
|
|
222
|
+
const apiRow = raw.prepare('SELECT COUNT(*) as c FROM api_endpoints').get();
|
|
223
|
+
totalApis = apiRow?.c || 0;
|
|
224
|
+
const pitRow = raw.prepare('SELECT COUNT(*) as c FROM pitfalls').get();
|
|
225
|
+
totalPitfalls = pitRow?.c || 0;
|
|
226
|
+
const exRow = raw.prepare('SELECT COUNT(*) as c FROM indexed_examples').get();
|
|
227
|
+
totalExamples = exRow?.c || 0;
|
|
228
|
+
const verRows = raw.prepare('SELECT DISTINCT doc_version FROM snapshots WHERE doc_version IS NOT NULL').all();
|
|
229
|
+
for (const r of verRows) {
|
|
230
|
+
if (r.doc_version)
|
|
231
|
+
activeVersions.add(r.doc_version);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// Best-effort stats aggregation
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
totalSources: sources.length,
|
|
239
|
+
totalPages,
|
|
240
|
+
totalChunks,
|
|
241
|
+
totalApis,
|
|
242
|
+
totalPitfalls,
|
|
243
|
+
totalExamples,
|
|
244
|
+
totalRecipes: 5,
|
|
245
|
+
activeVersions: Array.from(activeVersions).sort(),
|
|
246
|
+
dbPath: this.dbPath,
|
|
247
|
+
untrusted: true,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
readJsonBody(req) {
|
|
251
|
+
return new Promise((resolve, reject) => {
|
|
252
|
+
let body = '';
|
|
253
|
+
req.on('data', (chunk) => {
|
|
254
|
+
body += chunk.toString();
|
|
255
|
+
});
|
|
256
|
+
req.on('end', () => {
|
|
257
|
+
try {
|
|
258
|
+
resolve(body ? JSON.parse(body) : {});
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
reject(new Error('Invalid JSON payload'));
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
req.on('error', (err) => reject(err));
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Embedded HTML/CSS/JS dashboard UI for DocOrbit.
|
|
3
3
|
* Lightweight, zero external dependencies, zero CDN requests, fully offline capable.
|
|
4
4
|
*/
|
|
5
|
-
export function renderDashboardHtml()
|
|
6
|
-
|
|
5
|
+
export function renderDashboardHtml() {
|
|
6
|
+
return `<!DOCTYPE html>
|
|
7
7
|
<html lang="en">
|
|
8
8
|
<head>
|
|
9
9
|
<meta charset="UTF-8">
|