docorbit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +660 -0
- package/apps/cli/bin/docorbit.js +8 -0
- package/apps/cli/src/commands/add.ts +44 -0
- package/apps/cli/src/commands/api.ts +38 -0
- package/apps/cli/src/commands/context.ts +47 -0
- package/apps/cli/src/commands/dashboard.ts +55 -0
- package/apps/cli/src/commands/diff.ts +30 -0
- package/apps/cli/src/commands/evaluate.ts +133 -0
- package/apps/cli/src/commands/examples.ts +39 -0
- package/apps/cli/src/commands/export.ts +89 -0
- package/apps/cli/src/commands/impact.ts +31 -0
- package/apps/cli/src/commands/init.ts +69 -0
- package/apps/cli/src/commands/inspect.ts +30 -0
- package/apps/cli/src/commands/mcp.ts +72 -0
- package/apps/cli/src/commands/pitfalls.ts +38 -0
- package/apps/cli/src/commands/recipes.ts +35 -0
- package/apps/cli/src/commands/search.ts +48 -0
- package/apps/cli/src/commands/update.ts +73 -0
- package/apps/cli/src/commands/verify.ts +48 -0
- package/apps/cli/src/formatters/colors.ts +23 -0
- package/apps/cli/src/formatters/inspection.ts +102 -0
- package/apps/cli/src/formatters/knowledge.ts +272 -0
- package/apps/cli/src/formatters/retrieval.ts +74 -0
- package/apps/cli/src/formatters/terminal.ts +6 -0
- package/apps/cli/src/formatters/verification.ts +126 -0
- package/apps/cli/src/index.ts +409 -0
- package/bin/docorbit.js +8 -0
- package/package.json +46 -0
- package/packages/core/src/dashboard/server.ts +314 -0
- package/packages/core/src/dashboard/ui.ts +586 -0
- package/packages/core/src/implementation-service.ts +451 -0
- package/packages/core/src/index.ts +7 -0
- package/packages/core/src/inspector.ts +71 -0
- package/packages/core/src/pipeline.ts +331 -0
- package/packages/crawler/src/config.ts +12 -0
- package/packages/crawler/src/fetcher.ts +185 -0
- package/packages/crawler/src/index.ts +2 -0
- package/packages/discovery/src/index.ts +31 -0
- package/packages/discovery/src/provider.ts +47 -0
- package/packages/discovery/src/providers/generic.ts +98 -0
- package/packages/discovery/src/providers/github.ts +61 -0
- package/packages/discovery/src/providers/llms-txt.ts +73 -0
- package/packages/discovery/src/providers/markdown.ts +48 -0
- package/packages/discovery/src/providers/openapi.ts +91 -0
- package/packages/discovery/src/providers/sitemap.ts +62 -0
- package/packages/discovery/src/providers/skill.ts +54 -0
- package/packages/discovery/src/ranker.ts +123 -0
- package/packages/evaluation/src/dataset.ts +963 -0
- package/packages/evaluation/src/index.ts +8 -0
- package/packages/evaluation/src/runner.ts +241 -0
- package/packages/evaluation/src/strategies/context7-runner.ts +269 -0
- package/packages/evaluation/src/strategies/docorbit-runner.ts +228 -0
- package/packages/evaluation/src/strategies/firecrawl-runner.ts +172 -0
- package/packages/evaluation/src/strategies/web-search-runner.ts +194 -0
- package/packages/evaluation/src/types.ts +34 -0
- package/packages/evaluation/src/version-matcher.ts +73 -0
- package/packages/export/src/agents-md.ts +200 -0
- package/packages/export/src/claude-md.ts +141 -0
- package/packages/export/src/docs-map.ts +150 -0
- package/packages/export/src/index.ts +6 -0
- package/packages/export/src/llms-txt.ts +96 -0
- package/packages/export/src/service.ts +250 -0
- package/packages/export/src/skill-md.ts +128 -0
- package/packages/mcp/src/index.ts +46 -0
- package/packages/mcp/src/resources/index.ts +189 -0
- package/packages/mcp/src/server.ts +278 -0
- package/packages/mcp/src/tools/analyze-impact.ts +74 -0
- package/packages/mcp/src/tools/check-api.ts +86 -0
- package/packages/mcp/src/tools/diff-docs.ts +68 -0
- package/packages/mcp/src/tools/export-context.ts +73 -0
- package/packages/mcp/src/tools/find-api.ts +99 -0
- package/packages/mcp/src/tools/find-example.ts +100 -0
- package/packages/mcp/src/tools/find-pitfall.ts +94 -0
- package/packages/mcp/src/tools/find-recipe.ts +98 -0
- package/packages/mcp/src/tools/get-doc.ts +130 -0
- package/packages/mcp/src/tools/get-docs-map.ts +64 -0
- package/packages/mcp/src/tools/get-version.ts +118 -0
- package/packages/mcp/src/tools/implementation-context.ts +88 -0
- package/packages/mcp/src/tools/index.ts +59 -0
- package/packages/mcp/src/tools/list-sources.ts +85 -0
- package/packages/mcp/src/tools/search-docs.ts +123 -0
- package/packages/mcp/src/tools/types.ts +28 -0
- package/packages/mcp/src/transports/http.ts +256 -0
- package/packages/mcp/src/transports/stdio.ts +105 -0
- package/packages/mcp/src/transports/types.ts +6 -0
- package/packages/mcp/src/types.ts +102 -0
- package/packages/normalizer/src/example-indexer.ts +240 -0
- package/packages/normalizer/src/html.ts +253 -0
- package/packages/normalizer/src/index.ts +8 -0
- package/packages/normalizer/src/llms.ts +83 -0
- package/packages/normalizer/src/openapi/endpoint-parser.ts +406 -0
- package/packages/normalizer/src/openapi/schema-resolver.ts +111 -0
- package/packages/normalizer/src/openapi.ts +2 -0
- package/packages/normalizer/src/page.ts +184 -0
- package/packages/normalizer/src/pitfall-extractor.ts +190 -0
- package/packages/normalizer/src/slicer.ts +455 -0
- package/packages/retrieval/src/engine.ts +120 -0
- package/packages/retrieval/src/index.ts +7 -0
- package/packages/retrieval/src/intent.ts +43 -0
- package/packages/retrieval/src/packer.ts +145 -0
- package/packages/retrieval/src/recipe-engine.ts +313 -0
- package/packages/retrieval/src/scorer.ts +139 -0
- package/packages/retrieval/src/weights.ts +31 -0
- package/packages/security/src/annotations.ts +112 -0
- package/packages/security/src/index.ts +2 -0
- package/packages/security/src/ssrf.ts +153 -0
- package/packages/shared/src/errors.ts +53 -0
- package/packages/shared/src/hashing.ts +23 -0
- package/packages/shared/src/index.ts +3 -0
- package/packages/shared/src/types.ts +881 -0
- package/packages/storage/src/db.ts +72 -0
- package/packages/storage/src/index.ts +11 -0
- package/packages/storage/src/interfaces.ts +115 -0
- package/packages/storage/src/repositories/api-repository.ts +219 -0
- package/packages/storage/src/repositories/chunk-repository.ts +316 -0
- package/packages/storage/src/repositories/example-repository.ts +206 -0
- package/packages/storage/src/repositories/page-repository.ts +205 -0
- package/packages/storage/src/repositories/pitfall-repository.ts +188 -0
- package/packages/storage/src/repositories/source-repository.ts +205 -0
- package/packages/storage/src/repository.ts +256 -0
- package/packages/storage/src/schema.ts +269 -0
- package/packages/storage/src/search-tokens.ts +28 -0
- package/packages/verification/src/diff-engine.ts +258 -0
- package/packages/verification/src/extractor.ts +339 -0
- package/packages/verification/src/impact-scanner.ts +203 -0
- package/packages/verification/src/index.ts +5 -0
- package/packages/verification/src/services.ts +238 -0
- package/packages/verification/src/verifier.ts +375 -0
- package/packages/workspace/src/detector.ts +143 -0
- package/packages/workspace/src/ecosystems/cargo.ts +84 -0
- package/packages/workspace/src/ecosystems/composer.ts +42 -0
- package/packages/workspace/src/ecosystems/go.ts +54 -0
- package/packages/workspace/src/ecosystems/index.ts +34 -0
- package/packages/workspace/src/ecosystems/maven.ts +34 -0
- package/packages/workspace/src/ecosystems/npm.ts +83 -0
- package/packages/workspace/src/ecosystems/pub.ts +40 -0
- package/packages/workspace/src/ecosystems/pypi.ts +100 -0
- package/packages/workspace/src/ecosystems/rubygems.ts +30 -0
- package/packages/workspace/src/ecosystems/types.ts +18 -0
- package/packages/workspace/src/index.ts +5 -0
- package/packages/workspace/src/lockfile.ts +194 -0
- package/packages/workspace/src/resolver.ts +234 -0
- package/packages/workspace/src/semver.ts +259 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { runInspectCommand } from './commands/inspect.ts';
|
|
2
|
+
import { runAddCommand } from './commands/add.ts';
|
|
3
|
+
import { runSearchCommand } from './commands/search.ts';
|
|
4
|
+
import { runContextCommand } from './commands/context.ts';
|
|
5
|
+
import { runInitCommand } from './commands/init.ts';
|
|
6
|
+
import { runUpdateCommand } from './commands/update.ts';
|
|
7
|
+
import { runApiCommand } from './commands/api.ts';
|
|
8
|
+
import { runExamplesCommand } from './commands/examples.ts';
|
|
9
|
+
import { runPitfallsCommand } from './commands/pitfalls.ts';
|
|
10
|
+
import { runRecipesCommand } from './commands/recipes.ts';
|
|
11
|
+
import { runMcpCommand } from './commands/mcp.ts';
|
|
12
|
+
import { runVerifyCommand } from './commands/verify.ts';
|
|
13
|
+
import { runDiffCommand } from './commands/diff.ts';
|
|
14
|
+
import { runImpactCommand } from './commands/impact.ts';
|
|
15
|
+
import { runDashboardCommand } from './commands/dashboard.ts';
|
|
16
|
+
import { runExportCommand } from './commands/export.ts';
|
|
17
|
+
import { handleEvaluateCommand } from './commands/evaluate.ts';
|
|
18
|
+
import type { ChunkType, PitfallKind } from '../../../packages/shared/src/index.ts';
|
|
19
|
+
|
|
20
|
+
const VERSION = '0.1.0';
|
|
21
|
+
|
|
22
|
+
function printHelp(): void {
|
|
23
|
+
console.log(`
|
|
24
|
+
DocOrbit — The Documentation Intelligence Layer for Coding Agents
|
|
25
|
+
Version: ${VERSION}
|
|
26
|
+
|
|
27
|
+
USAGE:
|
|
28
|
+
docorbit <command> [options]
|
|
29
|
+
|
|
30
|
+
COMMANDS:
|
|
31
|
+
init [dir] Scan workspace, detect project dependencies, resolve docs, and write docs.lock
|
|
32
|
+
update [pkg] Update docs.lock dependencies (selective or global refresh)
|
|
33
|
+
inspect <url> Probe target documentation domain for canonical machine-readable sources
|
|
34
|
+
add <url> Discover, rank, fetch, normalize, slice, and store documentation into local SQLite
|
|
35
|
+
search "<query>" Deterministic hybrid search across sliced documentation chunks
|
|
36
|
+
context "<task>" Pack relevant documentation context optimized for AI coding agent tasks
|
|
37
|
+
api "<query>" Search and inspect structured API endpoints (OpenAPI / Swagger)
|
|
38
|
+
examples "<task>" Search and filter first-class code examples by language, framework, or task
|
|
39
|
+
pitfalls "<task>" Search explicit warnings, deprecations, breaking changes, and runtime restrictions
|
|
40
|
+
recipes "<goal>" Deterministically compile evidence-grounded implementation recipes
|
|
41
|
+
verify <code/file>Verify agent code against indexed schemas and detect mismatches/deprecations
|
|
42
|
+
diff [source] Compare documentation versions and snapshots (detect added/removed/deprecated APIs)
|
|
43
|
+
impact [source] Analyze impact of doc changes on project workspace files
|
|
44
|
+
dashboard Launch local zero-dependency web inspection UI and verification playground (alias: ui)
|
|
45
|
+
export [format] Deterministically export agent guidance files (AGENTS.md, CLAUDE.md, skill.md, llms.txt, docs-map.md)
|
|
46
|
+
eval Run empirical comparative evaluation benchmark (DocOrbit vs Context7 vs Official Docs Fetch vs Firecrawl)
|
|
47
|
+
mcp Start agent-native Model Context Protocol (MCP) server (stdio / streamable HTTP)
|
|
48
|
+
|
|
49
|
+
OPTIONS:
|
|
50
|
+
--project <dir> Workspace root for project-aware dependency detection (default: current dir)
|
|
51
|
+
--doc-version <v> Target documentation version filter/boost (e.g. v14, 15.0)
|
|
52
|
+
--from <v> Base version for documentation diffing / impact analysis (e.g. v14)
|
|
53
|
+
--to <v> Target version for documentation diffing / impact analysis (e.g. v15)
|
|
54
|
+
--library <lib> Filter or target specific library (e.g. stripe, next)
|
|
55
|
+
--format <fmt> Export format: agents.md, claude.md, skill.md, llms.txt, docs-map.md
|
|
56
|
+
--output <path> Custom output file path for export command
|
|
57
|
+
--stdout Print exported agent content directly to stdout
|
|
58
|
+
--json Output results as structured JSON
|
|
59
|
+
--db <path> Custom SQLite database path (default: .docorbit/docorbit.db)
|
|
60
|
+
--tokens <num> Token budget for context packaging (default: 3000)
|
|
61
|
+
--limit <num> Maximum search results to return (default: 10)
|
|
62
|
+
--type <type> Filter by chunk type: prose, code, api, warning, example, mixed
|
|
63
|
+
--method <method> Filter API endpoints by HTTP method: get, post, put, delete, patch
|
|
64
|
+
--language <lang> Filter code examples by language: typescript, python, go, rust, bash
|
|
65
|
+
--framework <fw> Filter code examples by framework: next, react, express, fastapi, flask
|
|
66
|
+
--kind <kind> Filter pitfalls by kind: deprecated, removed, breaking_change, server_only, rate_limit, security
|
|
67
|
+
--stdio Run MCP server over standard I/O (stdin/stdout) (default)
|
|
68
|
+
--port <num> Port for HTTP server or dashboard (default: 3737 for dashboard)
|
|
69
|
+
--host <ip> Host to bind HTTP transport / dashboard (default: 127.0.0.1)
|
|
70
|
+
--max-pages <num> Maximum pages to crawl and ingest (default: 50)
|
|
71
|
+
--allow-localhost Allow localhost / loopback targets (useful for local development & testing)
|
|
72
|
+
-h, --help Show this help message
|
|
73
|
+
-v, --version Show DocOrbit version
|
|
74
|
+
|
|
75
|
+
EXAMPLES:
|
|
76
|
+
docorbit init .
|
|
77
|
+
docorbit verify "fetch('/v1/charges', { method: 'POST' })" --doc-version v14
|
|
78
|
+
docorbit diff --from v14 --to v15
|
|
79
|
+
docorbit impact --from v14 --to v15 --project .
|
|
80
|
+
docorbit mcp --stdio
|
|
81
|
+
docorbit api "create subscription" --doc-version v1
|
|
82
|
+
docorbit examples "verify webhook signature" --language typescript --framework express
|
|
83
|
+
docorbit pitfalls "server actions" --kind server_only --doc-version v14
|
|
84
|
+
docorbit recipes "Handle webhook signature verification in Next.js" --project .
|
|
85
|
+
`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export async function main(args: string[] = process.argv.slice(2)): Promise<void> {
|
|
89
|
+
if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
|
|
90
|
+
printHelp();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (args.includes('-v') || args.includes('--version')) {
|
|
95
|
+
console.log(`DocOrbit v${VERSION}`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const command = args[0];
|
|
100
|
+
const queryArg = args[1]?.startsWith('-') ? undefined : args[1];
|
|
101
|
+
|
|
102
|
+
const isJson = args.includes('--json');
|
|
103
|
+
const allowLocalhost = args.includes('--allow-localhost');
|
|
104
|
+
|
|
105
|
+
let dbPath: string | undefined;
|
|
106
|
+
const dbIdx = args.indexOf('--db');
|
|
107
|
+
if (dbIdx !== -1 && args[dbIdx + 1]) {
|
|
108
|
+
dbPath = args[dbIdx + 1];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let projectDir: string | undefined;
|
|
112
|
+
const projIdx = args.indexOf('--project');
|
|
113
|
+
if (projIdx !== -1 && args[projIdx + 1]) {
|
|
114
|
+
projectDir = args[projIdx + 1];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let docVersion: string | undefined;
|
|
118
|
+
const docVerIdx = args.indexOf('--doc-version');
|
|
119
|
+
if (docVerIdx !== -1 && args[docVerIdx + 1]) {
|
|
120
|
+
docVersion = args[docVerIdx + 1];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let maxPages: number | undefined;
|
|
124
|
+
const maxPagesIdx = args.indexOf('--max-pages');
|
|
125
|
+
if (maxPagesIdx !== -1 && args[maxPagesIdx + 1]) {
|
|
126
|
+
maxPages = parseInt(args[maxPagesIdx + 1], 10);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
let limit: number | undefined;
|
|
130
|
+
const limitIdx = args.indexOf('--limit');
|
|
131
|
+
if (limitIdx !== -1 && args[limitIdx + 1]) {
|
|
132
|
+
limit = parseInt(args[limitIdx + 1], 10);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let tokens: number | undefined;
|
|
136
|
+
const tokensIdx = args.indexOf('--tokens');
|
|
137
|
+
if (tokensIdx !== -1 && args[tokensIdx + 1]) {
|
|
138
|
+
tokens = parseInt(args[tokensIdx + 1], 10);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let chunkType: ChunkType | undefined;
|
|
142
|
+
const typeIdx = args.indexOf('--type');
|
|
143
|
+
if (typeIdx !== -1 && args[typeIdx + 1]) {
|
|
144
|
+
chunkType = args[typeIdx + 1] as ChunkType;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let method: string | undefined;
|
|
148
|
+
const methodIdx = args.indexOf('--method');
|
|
149
|
+
if (methodIdx !== -1 && args[methodIdx + 1]) {
|
|
150
|
+
method = args[methodIdx + 1];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
let language: string | undefined;
|
|
154
|
+
const langIdx = args.indexOf('--language');
|
|
155
|
+
if (langIdx !== -1 && args[langIdx + 1]) {
|
|
156
|
+
language = args[langIdx + 1];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
let framework: string | undefined;
|
|
160
|
+
const fwIdx = args.indexOf('--framework');
|
|
161
|
+
if (fwIdx !== -1 && args[fwIdx + 1]) {
|
|
162
|
+
framework = args[fwIdx + 1];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
let kind: PitfallKind | undefined;
|
|
166
|
+
const kindIdx = args.indexOf('--kind');
|
|
167
|
+
if (kindIdx !== -1 && args[kindIdx + 1]) {
|
|
168
|
+
kind = args[kindIdx + 1] as PitfallKind;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const isStdio = args.includes('--stdio');
|
|
172
|
+
|
|
173
|
+
let port: number | undefined;
|
|
174
|
+
const portIdx = args.indexOf('--port');
|
|
175
|
+
if (portIdx !== -1 && args[portIdx + 1]) {
|
|
176
|
+
port = parseInt(args[portIdx + 1], 10);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
let host: string | undefined;
|
|
180
|
+
const hostIdx = args.indexOf('--host');
|
|
181
|
+
if (hostIdx !== -1 && args[hostIdx + 1]) {
|
|
182
|
+
host = args[hostIdx + 1];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
let fromVersion: string | undefined;
|
|
186
|
+
const fromIdx = args.indexOf('--from');
|
|
187
|
+
if (fromIdx !== -1 && args[fromIdx + 1]) {
|
|
188
|
+
fromVersion = args[fromIdx + 1];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let toVersion: string | undefined;
|
|
192
|
+
const toIdx = args.indexOf('--to');
|
|
193
|
+
if (toIdx !== -1 && args[toIdx + 1]) {
|
|
194
|
+
toVersion = args[toIdx + 1];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
let library: string | undefined;
|
|
198
|
+
const libIdx = args.indexOf('--library');
|
|
199
|
+
if (libIdx !== -1 && args[libIdx + 1]) {
|
|
200
|
+
library = args[libIdx + 1];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
let output: string | undefined;
|
|
204
|
+
const outIdx = args.indexOf('--output');
|
|
205
|
+
if (outIdx !== -1 && args[outIdx + 1]) {
|
|
206
|
+
output = args[outIdx + 1];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let format: string | undefined;
|
|
210
|
+
const fmtIdx = args.indexOf('--format');
|
|
211
|
+
if (fmtIdx !== -1 && args[fmtIdx + 1]) {
|
|
212
|
+
format = args[fmtIdx + 1];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
let targetSource: string | undefined;
|
|
216
|
+
const srcIdx = args.indexOf('--source');
|
|
217
|
+
if (srcIdx !== -1 && args[srcIdx + 1]) {
|
|
218
|
+
targetSource = args[srcIdx + 1];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
let evalSplit: string | undefined;
|
|
222
|
+
const splitIdx = args.indexOf('--split');
|
|
223
|
+
if (splitIdx !== -1 && args[splitIdx + 1]) {
|
|
224
|
+
evalSplit = args[splitIdx + 1];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
let evalStrategy: string | undefined;
|
|
228
|
+
const stratIdx = args.indexOf('--strategy');
|
|
229
|
+
if (stratIdx !== -1 && args[stratIdx + 1]) {
|
|
230
|
+
evalStrategy = args[stratIdx + 1];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
let evalTask: string | undefined;
|
|
234
|
+
const taskIdx = args.indexOf('--task');
|
|
235
|
+
if (taskIdx !== -1 && args[taskIdx + 1]) {
|
|
236
|
+
evalTask = args[taskIdx + 1];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const isStdout = args.includes('--stdout');
|
|
240
|
+
const noOpen = args.includes('--no-open');
|
|
241
|
+
const isVerbose = args.includes('--verbose');
|
|
242
|
+
|
|
243
|
+
switch (command) {
|
|
244
|
+
case 'init': {
|
|
245
|
+
const targetDir = queryArg || projectDir || '.';
|
|
246
|
+
await runInitCommand(targetDir, { json: isJson, dbPath });
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
case 'update': {
|
|
250
|
+
const targetPkg = queryArg;
|
|
251
|
+
await runUpdateCommand(targetPkg, { json: isJson, dbPath, projectDir });
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
case 'inspect': {
|
|
255
|
+
if (!queryArg) {
|
|
256
|
+
console.error('Error: "inspect" requires a target URL argument.');
|
|
257
|
+
printHelp();
|
|
258
|
+
process.exit(1);
|
|
259
|
+
}
|
|
260
|
+
await runInspectCommand(queryArg, { json: isJson, allowLocalhost });
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case 'add': {
|
|
264
|
+
if (!queryArg) {
|
|
265
|
+
console.error('Error: "add" requires a target URL argument.');
|
|
266
|
+
printHelp();
|
|
267
|
+
process.exit(1);
|
|
268
|
+
}
|
|
269
|
+
await runAddCommand(queryArg, { json: isJson, dbPath, maxPages, allowLocalhost });
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
case 'search': {
|
|
273
|
+
if (!queryArg) {
|
|
274
|
+
console.error('Error: "search" requires a query string argument.');
|
|
275
|
+
printHelp();
|
|
276
|
+
process.exit(1);
|
|
277
|
+
}
|
|
278
|
+
await runSearchCommand(queryArg, { json: isJson, dbPath, limit, chunkType, docVersion, projectDir });
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
case 'context': {
|
|
282
|
+
if (!queryArg) {
|
|
283
|
+
console.error('Error: "context" requires a task description argument.');
|
|
284
|
+
printHelp();
|
|
285
|
+
process.exit(1);
|
|
286
|
+
}
|
|
287
|
+
await runContextCommand(queryArg, { json: isJson, dbPath, tokens, docVersion, projectDir });
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
case 'api': {
|
|
291
|
+
await runApiCommand(queryArg || '', { method, docVersion, projectDir, limit, json: isJson, dbPath });
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case 'examples': {
|
|
295
|
+
await runExamplesCommand(queryArg || '', { language, framework, docVersion, projectDir, limit, json: isJson, dbPath });
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
case 'pitfalls': {
|
|
299
|
+
await runPitfallsCommand(queryArg || '', { kind, docVersion, projectDir, limit, json: isJson, dbPath });
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
case 'recipes': {
|
|
303
|
+
if (!queryArg) {
|
|
304
|
+
console.error('Error: "recipes" requires an implementation goal argument.');
|
|
305
|
+
printHelp();
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
await runRecipesCommand(queryArg, { docVersion, projectDir, json: isJson, dbPath });
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
case 'mcp': {
|
|
312
|
+
await runMcpCommand({
|
|
313
|
+
stdio: isStdio || !port,
|
|
314
|
+
port,
|
|
315
|
+
host,
|
|
316
|
+
dbPath,
|
|
317
|
+
projectDir,
|
|
318
|
+
});
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
case 'verify':
|
|
322
|
+
case 'check-api': {
|
|
323
|
+
if (!queryArg) {
|
|
324
|
+
console.error('Error: "verify" requires a code snippet or file path argument.');
|
|
325
|
+
printHelp();
|
|
326
|
+
process.exit(1);
|
|
327
|
+
}
|
|
328
|
+
await runVerifyCommand(queryArg, {
|
|
329
|
+
docVersion,
|
|
330
|
+
projectDir,
|
|
331
|
+
library,
|
|
332
|
+
language,
|
|
333
|
+
json: isJson,
|
|
334
|
+
dbPath,
|
|
335
|
+
});
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
case 'diff': {
|
|
339
|
+
await runDiffCommand(queryArg || '', {
|
|
340
|
+
from: fromVersion,
|
|
341
|
+
to: toVersion,
|
|
342
|
+
json: isJson,
|
|
343
|
+
dbPath,
|
|
344
|
+
});
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
case 'impact': {
|
|
348
|
+
await runImpactCommand(queryArg || '', {
|
|
349
|
+
from: fromVersion,
|
|
350
|
+
to: toVersion,
|
|
351
|
+
projectDir,
|
|
352
|
+
json: isJson,
|
|
353
|
+
dbPath,
|
|
354
|
+
});
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
case 'dashboard':
|
|
358
|
+
case 'ui': {
|
|
359
|
+
await runDashboardCommand({
|
|
360
|
+
port,
|
|
361
|
+
host,
|
|
362
|
+
projectDir,
|
|
363
|
+
dbPath,
|
|
364
|
+
noOpen,
|
|
365
|
+
});
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
case 'export': {
|
|
369
|
+
await runExportCommand(queryArg || format, {
|
|
370
|
+
format,
|
|
371
|
+
output,
|
|
372
|
+
stdout: isStdout,
|
|
373
|
+
projectDir,
|
|
374
|
+
docVersion,
|
|
375
|
+
targetSource,
|
|
376
|
+
json: isJson,
|
|
377
|
+
dbPath,
|
|
378
|
+
});
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
case 'eval':
|
|
382
|
+
case 'evaluate':
|
|
383
|
+
case 'benchmark': {
|
|
384
|
+
await handleEvaluateCommand({
|
|
385
|
+
split: evalSplit,
|
|
386
|
+
strategy: evalStrategy,
|
|
387
|
+
task: evalTask,
|
|
388
|
+
output,
|
|
389
|
+
json: isJson,
|
|
390
|
+
verbose: isVerbose,
|
|
391
|
+
simulation: args.includes('--simulation'),
|
|
392
|
+
});
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
default: {
|
|
396
|
+
console.error(`Unknown command: "${command}"\n`);
|
|
397
|
+
printHelp();
|
|
398
|
+
process.exit(1);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Direct CLI invocation
|
|
404
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
405
|
+
main().catch(err => {
|
|
406
|
+
console.error('Fatal DocOrbit Error:', err);
|
|
407
|
+
process.exit(1);
|
|
408
|
+
});
|
|
409
|
+
}
|
package/bin/docorbit.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docorbit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Documentation Intelligence Layer for AI Coding Agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "packages/core/src/index.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"docorbit": "./bin/docorbit.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin",
|
|
12
|
+
"apps",
|
|
13
|
+
"packages",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=22.6.0"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "node --experimental-strip-types --test tests/unit/*.test.ts tests/integration/*.test.ts",
|
|
22
|
+
"test:unit": "node --experimental-strip-types --test tests/unit/*.test.ts",
|
|
23
|
+
"test:integration": "node --experimental-strip-types --test tests/integration/*.test.ts",
|
|
24
|
+
"docorbit": "node --experimental-strip-types bin/docorbit.js",
|
|
25
|
+
"prepack": "npm test"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/HakashiKatake/docorbit.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/HakashiKatake/docorbit/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/HakashiKatake/docorbit#readme",
|
|
35
|
+
"keywords": [
|
|
36
|
+
"documentation",
|
|
37
|
+
"ai-agents",
|
|
38
|
+
"mcp",
|
|
39
|
+
"coding-agents",
|
|
40
|
+
"openapi",
|
|
41
|
+
"llms-txt",
|
|
42
|
+
"context"
|
|
43
|
+
],
|
|
44
|
+
"author": "DocOrbit Team",
|
|
45
|
+
"license": "MIT"
|
|
46
|
+
}
|