docbridge 0.12.0 → 0.13.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/CHANGELOG.md +26 -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 +21 -11
- package/dist/workers/java/docbridge-java-scanner.jar +0 -0
- 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
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.13.0] - 2026-10-01
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Java is a first-party code language. Configure `include.code.java` with
|
|
15
|
+
`.java` patterns and put `@doc` in the Javadoc comment of a class,
|
|
16
|
+
interface, enum, record, annotation type, method, constructor, field, or
|
|
17
|
+
enum constant. The bundled worker runs on the JDK 17 or later installed on
|
|
18
|
+
the machine, on any platform, and parses with the JDK's own `jdk.compiler`
|
|
19
|
+
module; it never compiles, loads, or runs project code. Canonical IDs are
|
|
20
|
+
dot-qualified without the package, and methods and constructors add their
|
|
21
|
+
parameter types (`AuthService.login(String,char[])`,
|
|
22
|
+
`AuthService.AuthService(Authenticator)`), so each overload is its own
|
|
23
|
+
endpoint. Visibility accepts `public`, `protected`, `package`, and
|
|
24
|
+
`private` and defaults to `public`; interface members without a modifier
|
|
25
|
+
are `public`. Projects that run `javadoc` with `-Xdoclint` register the tag
|
|
26
|
+
with `-tag doc:a:"DocBridge:"`.
|
|
27
|
+
- `scanners.java.command` or `DOCBRIDGE_JAVA_RUNTIME` names the JDK's `java`;
|
|
28
|
+
otherwise DocBridge uses `java` on `PATH`. A missing or too-old JDK, or a
|
|
29
|
+
Java runtime without `jdk.compiler` such as a JRE, is
|
|
30
|
+
`code_scanner_unavailable` naming what was found.
|
|
31
|
+
- The VS Code extension activates for Java files, and `docbridge init`
|
|
32
|
+
proposes `src/main/java` when it holds Java files, else `src`.
|
|
33
|
+
|
|
10
34
|
## [0.12.0] - 2026-10-01
|
|
11
35
|
|
|
12
36
|
### Added
|
|
@@ -523,7 +547,8 @@ Initial release of the SpecLink CLI.
|
|
|
523
547
|
- `speclink check` command with `--root`, `--json`, and `--audit` options.
|
|
524
548
|
- `speclink --version` (alias `-v`) and `speclink --help` (alias `-h`).
|
|
525
549
|
|
|
526
|
-
[Unreleased]: https://github.com/salan70/docbridge/compare/v0.
|
|
550
|
+
[Unreleased]: https://github.com/salan70/docbridge/compare/v0.13.0...HEAD
|
|
551
|
+
[0.13.0]: https://github.com/salan70/docbridge/releases/tag/v0.13.0
|
|
527
552
|
[0.12.0]: https://github.com/salan70/docbridge/releases/tag/v0.12.0
|
|
528
553
|
[0.11.0]: https://github.com/salan70/docbridge/releases/tag/v0.11.0
|
|
529
554
|
[0.10.1]: https://github.com/salan70/docbridge/releases/tag/v0.10.1
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
DocBridge keeps Markdown documentation and the code that implements it linked
|
|
8
8
|
in both directions. It validates `@doc` annotations on supported TypeScript,
|
|
9
|
-
JavaScript, Swift, Dart, Rust, Go, Python, and
|
|
9
|
+
JavaScript, Swift, Dart, Rust, Go, Python, Ruby, and Java declarations against
|
|
10
10
|
`@code` annotations on Markdown headings, so humans and coding agents can find the right counterpart before a
|
|
11
11
|
change drifts.
|
|
12
12
|
|
|
@@ -16,8 +16,8 @@ change drifts.
|
|
|
16
16
|
- A project containing Markdown and supported source files
|
|
17
17
|
|
|
18
18
|
Prebuilt Swift, Dart, Rust, and Go scanners are included for `darwin-arm64` and
|
|
19
|
-
`linux-x64`. Python and
|
|
20
|
-
or later on the machine, on any platform. See
|
|
19
|
+
`linux-x64`. Python, Ruby, and Java projects need CPython 3.10 or later,
|
|
20
|
+
CRuby 3.3 or later, or a JDK 17 or later on the machine, on any platform. See
|
|
21
21
|
[Languages](docs/user/configuration.md#languages) for each language's file
|
|
22
22
|
extensions, visibility defaults, and scanner.
|
|
23
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
bb2e127396b445a443c6d9958430b9af7e992ecca54cac49ce8feb88c199f460 docbridge-swift-scanner
|
|
2
|
+
32032f9e2c703f4ab4976361f15f723a58c675545edce90fdc673d3094fe154e docbridge_dart_scanner
|
|
3
3
|
7fc3e6842b3e1bf425b8fd63e241eee7e64875f16be7ba8d1ae4a25baa7f2338 docbridge-rust-scanner
|
|
4
|
-
|
|
4
|
+
1a7160cf70cb6ff1517d72685b6ecbfe1878ed1fed013fef706e5f2405ddbce0 docbridge-go-scanner
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
6e78c1c79c16572ed0759bfcf24ddd4cc77c7d1d699d19dc0279a9abca38d248 docbridge-swift-scanner
|
|
2
2
|
b75b14006ca792ed3ca8faf7ceee9e4d33c895f27dd416b640818cf8a4bdd9c8 docbridge_dart_scanner
|
|
3
3
|
e0da7b8cc6ee23704f5fe8514cc309f0bb60380c77b55e3bc5ed113abd1f3478 docbridge-rust-scanner
|
|
4
|
-
|
|
4
|
+
af845c263f65cc5db5beb01b4f4f7251ce449391986b4e288c03abfa04f7e708 docbridge-go-scanner
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/bin/linux-x64/docbridge-swift-scanner
|
|
3
3
|
size: 40932352 bytes
|
|
4
|
-
sha256:
|
|
4
|
+
sha256: 6e78c1c79c16572ed0759bfcf24ddd4cc77c7d1d699d19dc0279a9abca38d248
|
package/dist/index.js
CHANGED
|
@@ -175581,7 +175581,7 @@ import { join as join15, resolve as resolve5 } from "node:path";
|
|
|
175581
175581
|
// package.json
|
|
175582
175582
|
var package_default = {
|
|
175583
175583
|
name: "docbridge",
|
|
175584
|
-
version: "0.
|
|
175584
|
+
version: "0.13.0",
|
|
175585
175585
|
description: "A CLI that links Markdown specifications and code declarations. Runs on Node.js and Bun.",
|
|
175586
175586
|
keywords: [
|
|
175587
175587
|
"bun",
|
|
@@ -175781,7 +175781,8 @@ var KNOWN_CODE_LANGUAGES = [
|
|
|
175781
175781
|
"go",
|
|
175782
175782
|
"javascript",
|
|
175783
175783
|
"python",
|
|
175784
|
-
"ruby"
|
|
175784
|
+
"ruby",
|
|
175785
|
+
"java"
|
|
175785
175786
|
];
|
|
175786
175787
|
function isCodeLanguage(value) {
|
|
175787
175788
|
return KNOWN_CODE_LANGUAGES.includes(value);
|
|
@@ -175794,7 +175795,8 @@ var LANGUAGE_SUFFIXES = {
|
|
|
175794
175795
|
go: [".go"],
|
|
175795
175796
|
javascript: [".js", ".jsx", ".mjs", ".cjs"],
|
|
175796
175797
|
python: [".py"],
|
|
175797
|
-
ruby: [".rb"]
|
|
175798
|
+
ruby: [".rb"],
|
|
175799
|
+
java: [".java"]
|
|
175798
175800
|
};
|
|
175799
175801
|
var EXCLUDED_SUFFIXES = {
|
|
175800
175802
|
typescript: [".d.ts", ".d.mts", ".d.cts"],
|
|
@@ -175804,7 +175806,8 @@ var EXCLUDED_SUFFIXES = {
|
|
|
175804
175806
|
go: [],
|
|
175805
175807
|
javascript: [],
|
|
175806
175808
|
python: [],
|
|
175807
|
-
ruby: []
|
|
175809
|
+
ruby: [],
|
|
175810
|
+
java: []
|
|
175808
175811
|
};
|
|
175809
175812
|
function codeFenceLanguage(language, filePath) {
|
|
175810
175813
|
if (language === "typescript") {
|
|
@@ -175924,7 +175927,8 @@ var LANGUAGE_VISIBILITY = {
|
|
|
175924
175927
|
go: ["exported", "unexported"],
|
|
175925
175928
|
javascript: ["public", "protected", "private"],
|
|
175926
175929
|
python: ["public", "private"],
|
|
175927
|
-
ruby: ["public", "protected", "private"]
|
|
175930
|
+
ruby: ["public", "protected", "private"],
|
|
175931
|
+
java: ["public", "protected", "package", "private"]
|
|
175928
175932
|
};
|
|
175929
175933
|
function loadConfig(projectRoot) {
|
|
175930
175934
|
let rawText;
|
|
@@ -179326,7 +179330,7 @@ function failure(spec, language, code, reason) {
|
|
|
179326
179330
|
diagnostic: {
|
|
179327
179331
|
severity: "error",
|
|
179328
179332
|
code,
|
|
179329
|
-
|
|
179333
|
+
language,
|
|
179330
179334
|
target: language,
|
|
179331
179335
|
message: `${spec.label} scanner worker ${state}: ${reason}`
|
|
179332
179336
|
}
|
|
@@ -179440,7 +179444,8 @@ var builtInAdapters = {
|
|
|
179440
179444
|
go: createScannerWorkerAdapter("go", () => resolveScannerWorkerCommand("go")),
|
|
179441
179445
|
javascript: javaScriptAdapter,
|
|
179442
179446
|
python: runtimeWorkerAdapter("python"),
|
|
179443
|
-
ruby: runtimeWorkerAdapter("ruby")
|
|
179447
|
+
ruby: runtimeWorkerAdapter("ruby"),
|
|
179448
|
+
java: runtimeWorkerAdapter("java")
|
|
179444
179449
|
};
|
|
179445
179450
|
function runtimeWorkerAdapter(language) {
|
|
179446
179451
|
const resolution = ({ projectRoot, scanners }) => {
|
|
@@ -181743,6 +181748,7 @@ var DART_PATTERNS = ["lib/**/*.dart"];
|
|
|
181743
181748
|
var RUST_PATTERNS = ["src/**/*.rs", "*/src/**/*.rs"];
|
|
181744
181749
|
var GO_PATTERNS = ["*.go", "cmd/**/*.go", "internal/**/*.go", "pkg/**/*.go"];
|
|
181745
181750
|
var RUBY_PATTERNS = ["lib/**/*.rb", "app/**/*.rb"];
|
|
181751
|
+
var JAVA_PATTERNS = ["src/main/java/**/*.java", "src/**/*.java"];
|
|
181746
181752
|
var LANGUAGE_PATTERNS = {
|
|
181747
181753
|
typescript: TYPESCRIPT_PATTERNS,
|
|
181748
181754
|
swift: SWIFT_PATTERNS,
|
|
@@ -181750,7 +181756,8 @@ var LANGUAGE_PATTERNS = {
|
|
|
181750
181756
|
rust: RUST_PATTERNS,
|
|
181751
181757
|
go: GO_PATTERNS,
|
|
181752
181758
|
javascript: JAVASCRIPT_PATTERNS,
|
|
181753
|
-
ruby: RUBY_PATTERNS
|
|
181759
|
+
ruby: RUBY_PATTERNS,
|
|
181760
|
+
java: JAVA_PATTERNS
|
|
181754
181761
|
};
|
|
181755
181762
|
var EXCLUDED_CODE_SEGMENTS = {
|
|
181756
181763
|
typescript: ["__tests__", "tests", "test"],
|
|
@@ -181760,7 +181767,8 @@ var EXCLUDED_CODE_SEGMENTS = {
|
|
|
181760
181767
|
go: ["vendor", "testdata"],
|
|
181761
181768
|
javascript: ["__tests__", "tests", "test"],
|
|
181762
181769
|
python: ["tests", "venv", "dist", "site-packages"],
|
|
181763
|
-
ruby: ["spec", "test", "vendor"]
|
|
181770
|
+
ruby: ["spec", "test", "vendor"],
|
|
181771
|
+
java: ["target", "src/test"]
|
|
181764
181772
|
};
|
|
181765
181773
|
var TEST_FILE_PATTERNS = {
|
|
181766
181774
|
typescript: /\.(?:test|spec)\.[cm]?tsx?$/u,
|
|
@@ -181939,7 +181947,8 @@ function scriptPatterns(language) {
|
|
|
181939
181947
|
}
|
|
181940
181948
|
function activeCodePatterns(projectRoot, language) {
|
|
181941
181949
|
const candidates = language === "python" ? pythonPatterns(projectRoot) : LANGUAGE_PATTERNS[language];
|
|
181942
|
-
|
|
181950
|
+
const active = candidates.filter((pattern) => countCodeFiles(projectRoot, [pattern], language) > 0);
|
|
181951
|
+
return language === "java" ? active.slice(0, 1) : active;
|
|
181943
181952
|
}
|
|
181944
181953
|
function pythonPatterns(projectRoot) {
|
|
181945
181954
|
let entries;
|
|
@@ -181965,7 +181974,8 @@ function countCodeFiles(projectRoot, patterns, language) {
|
|
|
181965
181974
|
function isExcludedCodeFile(filePath, language) {
|
|
181966
181975
|
const lower = filePath.toLowerCase();
|
|
181967
181976
|
const segments = filePath.split("/");
|
|
181968
|
-
|
|
181977
|
+
const delimited = `/${filePath}/`;
|
|
181978
|
+
if (hasExcludedSuffix(language, lower) || TEST_FILE_PATTERNS[language]?.test(lower) === true || EXCLUDED_CODE_SEGMENTS[language].some((run) => delimited.includes(`/${run}/`))) {
|
|
181969
181979
|
return true;
|
|
181970
181980
|
}
|
|
181971
181981
|
if (segments.some((segment) => ["generated", "gen", ".dart_tool", "build"].includes(segment.toLowerCase()))) {
|
|
Binary file
|
|
@@ -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" },
|