docbridge 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -1
- package/README.md +3 -3
- package/dist/bin/darwin-arm64/SHA256SUMS +3 -3
- package/dist/bin/darwin-arm64/docbridge-go-scanner +0 -0
- package/dist/bin/darwin-arm64/docbridge-swift-scanner +0 -0
- package/dist/bin/darwin-arm64/docbridge_dart_scanner +0 -0
- package/dist/bin/linux-x64/SHA256SUMS +2 -2
- package/dist/bin/linux-x64/docbridge-go-scanner +0 -0
- package/dist/bin/linux-x64/docbridge-swift-scanner +1 -1
- package/dist/index.js +199 -325
- package/dist/workers/java/docbridge-java-scanner.jar +0 -0
- package/docs/README.md +1 -1
- package/docs/user/configuration.md +37 -30
- package/docs/user/getting-started.md +1 -1
- package/docs/user/linking.md +28 -1
- package/docs/user/troubleshooting.md +16 -12
- package/package.json +1 -1
- package/schemas/context-output.schema.json +11 -1
- package/schemas/docbridge.schema.json +24 -1
- package/schemas/graph-output.schema.json +11 -1
|
Binary file
|
package/docs/README.md
CHANGED
|
@@ -63,7 +63,7 @@ with the specification for the interface whose exact contract you need:
|
|
|
63
63
|
- [Commit messages](contributing/commits.md)
|
|
64
64
|
- [Pull requests](contributing/pull-requests.md)
|
|
65
65
|
- [Releasing](contributing/releasing.md)
|
|
66
|
-
- [Self-audit
|
|
66
|
+
- [Self-audit](contributing/self-audit.md)
|
|
67
67
|
|
|
68
68
|
## Historical records
|
|
69
69
|
|
|
@@ -57,22 +57,23 @@ source file may match only one language.
|
|
|
57
57
|
|
|
58
58
|
## Languages
|
|
59
59
|
|
|
60
|
-
| Key | Files | `visibility` values
|
|
61
|
-
| ------------ | ---------------------------------------------------- |
|
|
62
|
-
| `typescript` | `.ts`, `.tsx`, `.mts`, `.cts`, not declaration files | `public`, `protected`, `private`
|
|
63
|
-
| `javascript` | `.js`, `.jsx`, `.mjs`, `.cjs` | `public`, `protected`, `private`
|
|
64
|
-
| `swift` | `.swift` | `public`, `open`, `internal`
|
|
65
|
-
| `dart` | `.dart` | `public`
|
|
66
|
-
| `rust` | `.rs` | `pub`, `private`
|
|
67
|
-
| `go` | `.go` | `exported`, `unexported`
|
|
68
|
-
| `python` | `.py` | `public`, `private`
|
|
69
|
-
| `ruby` | `.rb` | `public`, `protected`, `private`
|
|
60
|
+
| Key | Files | `visibility` values | Default | Scanner |
|
|
61
|
+
| ------------ | ---------------------------------------------------- | ------------------------------------------- | --------------------- | ------------------------- |
|
|
62
|
+
| `typescript` | `.ts`, `.tsx`, `.mts`, `.cts`, not declaration files | `public`, `protected`, `private` | `public`, `protected` | built in |
|
|
63
|
+
| `javascript` | `.js`, `.jsx`, `.mjs`, `.cjs` | `public`, `protected`, `private` | `public`, `protected` | built in |
|
|
64
|
+
| `swift` | `.swift` | `public`, `open`, `internal` | `public`, `open` | `docbridge-swift-scanner` |
|
|
65
|
+
| `dart` | `.dart` | `public` | `public` | `docbridge_dart_scanner` |
|
|
66
|
+
| `rust` | `.rs` | `pub`, `private` | `pub` | `docbridge-rust-scanner` |
|
|
67
|
+
| `go` | `.go` | `exported`, `unexported` | `exported` | `docbridge-go-scanner` |
|
|
68
|
+
| `python` | `.py` | `public`, `private` | `public` | CPython 3.10 or later |
|
|
69
|
+
| `ruby` | `.rb` | `public`, `protected`, `private` | `public` | CRuby 3.3 or later |
|
|
70
|
+
| `java` | `.java` | `public`, `protected`, `package`, `private` | `public` | JDK 17 or later |
|
|
70
71
|
|
|
71
72
|
Patterns must end with one of the language's extensions. The npm package
|
|
72
73
|
bundles the Swift, Dart, Rust, and Go scanners for `darwin-arm64` and
|
|
73
74
|
`linux-x64`; TypeScript, JavaScript, and Markdown need no scanner binary.
|
|
74
|
-
Python and
|
|
75
|
-
interpreter installed on the machine, on any platform; see
|
|
75
|
+
Python, Ruby, and Java are scanned by workers in the package that run on the
|
|
76
|
+
interpreter or JDK installed on the machine, on any platform; see
|
|
76
77
|
[Scanner runtimes](#scanner-runtimes).
|
|
77
78
|
|
|
78
79
|
Each language accepts an optional `visibility` array; omitting it uses the
|
|
@@ -81,11 +82,12 @@ type members; top-level declarations must be exported, and every JavaScript
|
|
|
81
82
|
member is `public`. Rust `pub` means unrestricted `pub`, and `private` covers
|
|
82
83
|
every narrower visibility. A declaration excluded by visibility is not an
|
|
83
84
|
endpoint. An `@doc` on an excluded TypeScript or JavaScript member, or on an
|
|
84
|
-
excluded Python or
|
|
85
|
+
excluded Python, Ruby, or Java declaration, is `unsupported_declaration`; the Swift,
|
|
85
86
|
Dart, Rust, and Go scanners ignore an `@doc` on an excluded declaration
|
|
86
87
|
without a diagnostic. See `docbridge docs show linking` for the per-language
|
|
87
88
|
declaration rules, including Dart's and Python's leading-underscore privacy,
|
|
88
|
-
Go's exported-name rule for methods,
|
|
89
|
+
Go's exported-name rule for methods, Ruby's `private` calls, and Java's
|
|
90
|
+
implicitly public interface members. The
|
|
89
91
|
[Scanning specification](https://github.com/salan70/docbridge/blob/main/docs/specs/scanning.md)
|
|
90
92
|
owns the exact scanner behavior and platform keys.
|
|
91
93
|
|
|
@@ -93,13 +95,15 @@ owns the exact scanner behavior and platform keys.
|
|
|
93
95
|
|
|
94
96
|
## Scanner runtimes
|
|
95
97
|
|
|
96
|
-
Python and
|
|
97
|
-
installed on the machine: CPython 3.10 or later
|
|
98
|
-
bundled Prism parses the source
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
Python, Ruby, and Java files are scanned by workers that run on a runtime
|
|
99
|
+
installed on the machine: CPython 3.10 or later; CRuby 3.3 or later, whose
|
|
100
|
+
bundled Prism parses the source; and a JDK 17 or later, whose `jdk.compiler`
|
|
101
|
+
module parses the source. A JRE lacks that module and cannot scan Java.
|
|
102
|
+
DocBridge looks for `python3`, then `python` (`py -3`, then `python` on
|
|
103
|
+
Windows), for `ruby`, and for `java` on `PATH`, and checks each candidate
|
|
104
|
+
before using it. The workers never import, compile, or run project code.
|
|
101
105
|
|
|
102
|
-
To use another
|
|
106
|
+
To use another runtime, name it under `scanners`:
|
|
103
107
|
|
|
104
108
|
```json
|
|
105
109
|
{
|
|
@@ -113,13 +117,15 @@ To use another interpreter, name it under `scanners`:
|
|
|
113
117
|
}
|
|
114
118
|
```
|
|
115
119
|
|
|
116
|
-
`command` is the
|
|
117
|
-
than a shell string; a relative path resolves against the project
|
|
118
|
-
|
|
119
|
-
`
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
`command` is the runtime executable followed by its own arguments, as an
|
|
121
|
+
array rather than a shell string; a relative path resolves against the project
|
|
122
|
+
root. A Java entry names the JDK's `java`, such as
|
|
123
|
+
`["/opt/jdk-21/bin/java"]`. Without a configured command, the environment
|
|
124
|
+
variable `DOCBRIDGE_PYTHON_RUNTIME`, `DOCBRIDGE_RUBY_RUNTIME`, or
|
|
125
|
+
`DOCBRIDGE_JAVA_RUNTIME` can name one runtime executable instead. A configured
|
|
126
|
+
command or variable is the only runtime tried: when it is missing or unusable,
|
|
127
|
+
the files report `code_scanner_unavailable` instead of falling back to
|
|
128
|
+
`PATH`.
|
|
123
129
|
|
|
124
130
|
A configured command runs with your permissions in the CLI and in the editor
|
|
125
131
|
extension. Review `scanners` in a repository you do not trust before running
|
|
@@ -148,9 +154,10 @@ documentation should stay outside the graph:
|
|
|
148
154
|
```
|
|
149
155
|
|
|
150
156
|
For Go, `cmd/**/*.go` and `internal/**/*.go` scan fewer files than
|
|
151
|
-
`**/*.go`, but `_test.go` files under them are still scanned. For Python
|
|
152
|
-
Ruby, keep test directories such as `tests
|
|
153
|
-
in the same way
|
|
157
|
+
`**/*.go`, but `_test.go` files under them are still scanned. For Python,
|
|
158
|
+
Ruby, and Java, keep test directories such as `tests/`, `spec/`, and
|
|
159
|
+
`src/test/` outside the patterns in the same way; in a Maven or Gradle layout,
|
|
160
|
+
`src/main/java/**/*.java` does.
|
|
154
161
|
|
|
155
162
|
DocBridge always ignores dependency directories, Git metadata, dot-prefixed
|
|
156
163
|
path segments, symbolic links, and TypeScript declaration files (`.d.ts`,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Set up DocBridge in an existing TypeScript, JavaScript, Swift, Dart, Rust, Go, Python, or
|
|
2
|
+
description: Set up DocBridge in an existing TypeScript, JavaScript, Swift, Dart, Rust, Go, Python, Ruby, or Java project.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Getting Started
|
package/docs/user/linking.md
CHANGED
|
@@ -106,8 +106,13 @@ def login(email: str, password: str) -> None:
|
|
|
106
106
|
def login(email, password); end
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
```java
|
|
110
|
+
/** @doc docs/auth.md#login-flow */
|
|
111
|
+
public void login(String email, char[] password) {}
|
|
112
|
+
```
|
|
113
|
+
|
|
109
114
|
Paths are relative to the configured root. An annotation on an unsupported
|
|
110
|
-
declaration, or on a TypeScript, JavaScript, Python, or
|
|
115
|
+
declaration, or on a TypeScript, JavaScript, Python, Ruby, or Java declaration
|
|
111
116
|
excluded by visibility, produces `unsupported_declaration`; the same
|
|
112
117
|
declaration without an annotation is ignored. Swift, Dart, Rust, and Go ignore
|
|
113
118
|
an annotation on a declaration excluded by visibility without a diagnostic. To link such a declaration, add
|
|
@@ -209,6 +214,28 @@ file is one endpoint. Bare `private`, `protected`, and `public` calls,
|
|
|
209
214
|
modules, and constants are always `public`. `attr_reader` and its siblings,
|
|
210
215
|
`alias`, and `define_method` are not endpoints.
|
|
211
216
|
|
|
217
|
+
### Java declarations
|
|
218
|
+
|
|
219
|
+
Supported forms are top-level and nested classes, interfaces, enums, records,
|
|
220
|
+
and annotation types; methods and constructors; and fields and enum
|
|
221
|
+
constants. Put `@doc` in the declaration's Javadoc comment (`/** */`); `//`
|
|
222
|
+
and `/* */` comments are ignored. IDs are dot-qualified without the package,
|
|
223
|
+
and methods and constructors add their parameter types: `AuthService`,
|
|
224
|
+
`AuthService.MAX_ATTEMPTS`, `AuthService.login(String,char[])`, and
|
|
225
|
+
`AuthService.AuthService(Authenticator)` for a constructor. Parameter types
|
|
226
|
+
are written as in the source, without type arguments or annotations, and
|
|
227
|
+
varargs become arrays (`String...` is `String[]`). Visibility defaults to
|
|
228
|
+
`public`. Interface members without a modifier and enum constants are
|
|
229
|
+
`public`, and a member is never more visible than its enclosing types. Local
|
|
230
|
+
and anonymous classes, lambdas, and initializer blocks are not endpoints. An
|
|
231
|
+
`@doc` above a field statement that declares several names (`int a, b;`) is
|
|
232
|
+
`unsupported_declaration` because it cannot name one endpoint; link those
|
|
233
|
+
fields from `docbridge.links.json` instead.
|
|
234
|
+
|
|
235
|
+
`javadoc` reports `@doc` as an unknown tag when doclint runs with
|
|
236
|
+
`-Xdoclint`. Register the tag with `-tag doc:a:"DocBridge:"` so the check
|
|
237
|
+
accepts it.
|
|
238
|
+
|
|
212
239
|
<!-- @code src/scan/markdown/markdown.ts#scanMarkdown -->
|
|
213
240
|
|
|
214
241
|
## Documentation to code
|
|
@@ -36,15 +36,18 @@ lacks a binary for the current platform or the binary cannot execute.
|
|
|
36
36
|
Reinstall the package first. If the platform is not supported, run DocBridge
|
|
37
37
|
in a supported environment or build the scanner from the repository.
|
|
38
38
|
|
|
39
|
-
Python and
|
|
40
|
-
`code_scanner_unavailable` names the
|
|
41
|
-
version, and what it found for each candidate: no
|
|
42
|
-
version below CPython 3.10
|
|
43
|
-
load
|
|
44
|
-
or `
|
|
45
|
-
or `
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
Python, Ruby, and Java run on the runtime installed on the machine. For them,
|
|
40
|
+
`code_scanner_unavailable` names the runtime DocBridge needs, the minimum
|
|
41
|
+
version, and what it found for each candidate: no runtime on `PATH`, a
|
|
42
|
+
version below CPython 3.10, CRuby 3.3, or JDK 17, a Ruby whose bundled Prism
|
|
43
|
+
does not load, or a Java runtime without the `jdk.compiler` module, which is
|
|
44
|
+
what a JRE or a trimmed `jlink` image reports. Install a supported version on
|
|
45
|
+
`PATH`, or point `scanners.<language>.command` in the configuration, or
|
|
46
|
+
`DOCBRIDGE_PYTHON_RUNTIME`, `DOCBRIDGE_RUBY_RUNTIME`, or
|
|
47
|
+
`DOCBRIDGE_JAVA_RUNTIME` in the environment, at one; see
|
|
48
|
+
[Configuration](configuration.md#scanner-runtimes). For Java, that is the
|
|
49
|
+
`java` executable of a full JDK 17 or later, not a JRE. When the message names
|
|
50
|
+
one of those overrides, DocBridge tried only that runtime, so fix or remove
|
|
48
51
|
the override instead of installing another one.
|
|
49
52
|
|
|
50
53
|
`code_scanner_failed` diagnostics contain the worker failure rather than
|
|
@@ -54,9 +57,10 @@ Check that the source parses with the project's own toolchain, then reproduce
|
|
|
54
57
|
with the smallest configured file set.
|
|
55
58
|
|
|
56
59
|
`code_parse_error` means a TypeScript, JavaScript, Swift, Dart, Rust, Go,
|
|
57
|
-
Python, or
|
|
58
|
-
first error the language's parser found and includes the parser's message;
|
|
59
|
-
Python and
|
|
60
|
+
Python, Ruby, or Java source file has a syntax error. The diagnostic points at
|
|
61
|
+
the first error the language's parser found and includes the parser's message;
|
|
62
|
+
for Python, Ruby, and Java, the wording comes from the installed runtime, and
|
|
63
|
+
Java syntax newer than the installed JDK does not parse. DocBridge extracts no links or symbols
|
|
60
64
|
from that file, so fix the syntax before judging link diagnostics that involve
|
|
61
65
|
it. Unlike
|
|
62
66
|
`code_scanner_failed`, the worker ran correctly; the source itself did not
|
package/package.json
CHANGED
|
@@ -35,7 +35,17 @@
|
|
|
35
35
|
},
|
|
36
36
|
"language": {
|
|
37
37
|
"type": "string",
|
|
38
|
-
"enum": [
|
|
38
|
+
"enum": [
|
|
39
|
+
"typescript",
|
|
40
|
+
"swift",
|
|
41
|
+
"dart",
|
|
42
|
+
"rust",
|
|
43
|
+
"go",
|
|
44
|
+
"javascript",
|
|
45
|
+
"python",
|
|
46
|
+
"ruby",
|
|
47
|
+
"java"
|
|
48
|
+
],
|
|
39
49
|
"description": "Code language for code context blocks."
|
|
40
50
|
},
|
|
41
51
|
"startLine": {
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"go": { "$ref": "#/$defs/goEntry" },
|
|
26
26
|
"javascript": { "$ref": "#/$defs/javascriptEntry" },
|
|
27
27
|
"python": { "$ref": "#/$defs/pythonEntry" },
|
|
28
|
-
"ruby": { "$ref": "#/$defs/rubyEntry" }
|
|
28
|
+
"ruby": { "$ref": "#/$defs/rubyEntry" },
|
|
29
|
+
"java": { "$ref": "#/$defs/javaEntry" }
|
|
29
30
|
}
|
|
30
31
|
},
|
|
31
32
|
"docs": {
|
|
@@ -239,6 +240,28 @@
|
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
}
|
|
243
|
+
},
|
|
244
|
+
"javaEntry": {
|
|
245
|
+
"type": "object",
|
|
246
|
+
"additionalProperties": false,
|
|
247
|
+
"required": ["patterns"],
|
|
248
|
+
"properties": {
|
|
249
|
+
"patterns": {
|
|
250
|
+
"type": "array",
|
|
251
|
+
"minItems": 1,
|
|
252
|
+
"items": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"pattern": "\\.java$"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"visibility": {
|
|
258
|
+
"type": "array",
|
|
259
|
+
"items": {
|
|
260
|
+
"type": "string",
|
|
261
|
+
"enum": ["public", "protected", "package", "private"]
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
242
265
|
}
|
|
243
266
|
}
|
|
244
267
|
}
|
|
@@ -31,7 +31,17 @@
|
|
|
31
31
|
},
|
|
32
32
|
"language": {
|
|
33
33
|
"type": "string",
|
|
34
|
-
"enum": [
|
|
34
|
+
"enum": [
|
|
35
|
+
"typescript",
|
|
36
|
+
"swift",
|
|
37
|
+
"dart",
|
|
38
|
+
"rust",
|
|
39
|
+
"go",
|
|
40
|
+
"javascript",
|
|
41
|
+
"python",
|
|
42
|
+
"ruby",
|
|
43
|
+
"java"
|
|
44
|
+
],
|
|
35
45
|
"description": "Code language for code nodes."
|
|
36
46
|
},
|
|
37
47
|
"location": { "$ref": "common-output.schema.json#/$defs/location" },
|