docbridge 0.11.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 +81 -1
- package/README.md +16 -9
- 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 +1771 -678
- package/dist/workers/java/docbridge-java-scanner.jar +0 -0
- package/dist/workers/python/docbridge_python_scanner/__init__.py +6 -0
- package/dist/workers/python/docbridge_python_scanner/comments.py +177 -0
- package/dist/workers/python/docbridge_python_scanner/declarations.py +318 -0
- package/dist/workers/python/docbridge_python_scanner/links.py +62 -0
- package/dist/workers/python/docbridge_python_scanner/positions.py +75 -0
- package/dist/workers/python/docbridge_python_scanner/protocol.py +105 -0
- package/dist/workers/python/docbridge_python_scanner/scanner.py +214 -0
- package/dist/workers/python/docbridge_python_scanner.py +16 -0
- package/dist/workers/ruby/bin/docbridge-ruby-scanner +10 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner/cli.rb +30 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner/comments.rb +55 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner/compat.rb +39 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner/declarations.rb +230 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner/links.rb +38 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner/positions.rb +50 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner/probe.rb +28 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner/protocol.rb +161 -0
- package/dist/workers/ruby/lib/docbridge_ruby_scanner.rb +21 -0
- package/docs/README.md +10 -3
- package/docs/user/automation.md +8 -4
- package/docs/user/commands.md +11 -3
- package/docs/user/configuration.md +111 -17
- package/docs/user/getting-started.md +1 -1
- package/docs/user/linking.md +106 -10
- package/docs/user/troubleshooting.md +26 -9
- package/package.json +1 -1
- package/schemas/common-output.schema.json +11 -1
- package/schemas/context-output.schema.json +11 -1
- package/schemas/docbridge.schema.json +118 -2
- package/schemas/graph-output.schema.json +11 -1
- package/schemas/scanner-worker.schema.json +1 -1
- package/templates/skills/docbridge/SKILL.md +12 -2
|
@@ -6,7 +6,9 @@ description: "Configure docbridge.config.json: roots, include patterns, language
|
|
|
6
6
|
|
|
7
7
|
DocBridge loads `docbridge.config.json` from the project root supplied by
|
|
8
8
|
`--root`, or from the current directory by default. Paths and glob patterns are
|
|
9
|
-
interpreted relative to that root.
|
|
9
|
+
interpreted relative to that root. The exact rules for every key, pattern, and
|
|
10
|
+
value are in the
|
|
11
|
+
[Configuration specification](https://github.com/salan70/docbridge/blob/main/docs/specs/configuration.md).
|
|
10
12
|
|
|
11
13
|
<!-- @code src/config/config.ts#loadConfig -->
|
|
12
14
|
|
|
@@ -33,28 +35,110 @@ Declare documentation patterns and at least one supported code language:
|
|
|
33
35
|
}
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
Other languages use the same shape under their own key. A Go project that
|
|
39
|
+
documents its `internal` packages:
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"$schema": "./node_modules/docbridge/schemas/docbridge.schema.json",
|
|
44
|
+
"include": {
|
|
45
|
+
"code": {
|
|
46
|
+
"go": {
|
|
47
|
+
"patterns": ["internal/**/*.go"]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"docs": ["docs/**/*.md"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
A project can enable more than one language, each with its own patterns, but a
|
|
56
|
+
source file may match only one language.
|
|
57
|
+
|
|
58
|
+
## Languages
|
|
59
|
+
|
|
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 |
|
|
71
|
+
|
|
72
|
+
Patterns must end with one of the language's extensions. The npm package
|
|
73
|
+
bundles the Swift, Dart, Rust, and Go scanners for `darwin-arm64` and
|
|
74
|
+
`linux-x64`; TypeScript, JavaScript, and Markdown need no scanner binary.
|
|
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
|
|
77
|
+
[Scanner runtimes](#scanner-runtimes).
|
|
78
|
+
|
|
79
|
+
Each language accepts an optional `visibility` array; omitting it uses the
|
|
80
|
+
default above. TypeScript and JavaScript `visibility` applies only to class and
|
|
81
|
+
type members; top-level declarations must be exported, and every JavaScript
|
|
82
|
+
member is `public`. Rust `pub` means unrestricted `pub`, and `private` covers
|
|
83
|
+
every narrower visibility. A declaration excluded by visibility is not an
|
|
84
|
+
endpoint. An `@doc` on an excluded TypeScript or JavaScript member, or on an
|
|
85
|
+
excluded Python, Ruby, or Java declaration, is `unsupported_declaration`; the Swift,
|
|
86
|
+
Dart, Rust, and Go scanners ignore an `@doc` on an excluded declaration
|
|
87
|
+
without a diagnostic. See `docbridge docs show linking` for the per-language
|
|
88
|
+
declaration rules, including Dart's and Python's leading-underscore privacy,
|
|
89
|
+
Go's exported-name rule for methods, Ruby's `private` calls, and Java's
|
|
90
|
+
implicitly public interface members. The
|
|
91
|
+
[Scanning specification](https://github.com/salan70/docbridge/blob/main/docs/specs/scanning.md)
|
|
92
|
+
owns the exact scanner behavior and platform keys.
|
|
93
|
+
|
|
94
|
+
<!-- @code src/config/scanner-runtimes.ts#ScannerRuntimes -->
|
|
95
|
+
|
|
96
|
+
## Scanner runtimes
|
|
97
|
+
|
|
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.
|
|
105
|
+
|
|
106
|
+
To use another runtime, name it under `scanners`:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"include": {
|
|
111
|
+
"code": { "python": { "patterns": ["src/**/*.py"] } },
|
|
112
|
+
"docs": ["docs/**/*.md"]
|
|
113
|
+
},
|
|
114
|
+
"scanners": {
|
|
115
|
+
"python": { "command": ["/opt/python3.12/bin/python3"] }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
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`.
|
|
129
|
+
|
|
130
|
+
A configured command runs with your permissions in the CLI and in the editor
|
|
131
|
+
extension. Review `scanners` in a repository you do not trust before running
|
|
132
|
+
DocBridge there.
|
|
50
133
|
|
|
51
134
|
<!-- @code src/shared/glob.ts#collectFiles -->
|
|
135
|
+
<!-- @code src/config/code-language.ts#collectCodeFiles -->
|
|
52
136
|
|
|
53
137
|
## Excluded files
|
|
54
138
|
|
|
55
|
-
The configuration has no `exclude` property. Narrow the
|
|
56
|
-
tests, fixtures, generated files, or general
|
|
57
|
-
the graph:
|
|
139
|
+
The configuration has no `exclude` property and no glob negation. Narrow the
|
|
140
|
+
positive include patterns when tests, fixtures, generated files, or general
|
|
141
|
+
documentation should stay outside the graph:
|
|
58
142
|
|
|
59
143
|
```json
|
|
60
144
|
{
|
|
@@ -69,8 +153,15 @@ the graph:
|
|
|
69
153
|
}
|
|
70
154
|
```
|
|
71
155
|
|
|
156
|
+
For Go, `cmd/**/*.go` and `internal/**/*.go` scan fewer files than
|
|
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.
|
|
161
|
+
|
|
72
162
|
DocBridge always ignores dependency directories, Git metadata, dot-prefixed
|
|
73
|
-
path segments, symbolic links, and TypeScript declaration files (`.d.ts
|
|
163
|
+
path segments, symbolic links, and TypeScript declaration files (`.d.ts`,
|
|
164
|
+
`.d.mts`, and `.d.cts`).
|
|
74
165
|
Keep patterns narrow enough that `docbridge check --audit` reports useful
|
|
75
166
|
coverage gaps rather than every implementation detail or general prose file.
|
|
76
167
|
|
|
@@ -81,3 +172,6 @@ file, or invalid JSON, produces `config_file_invalid`. An unknown key produces
|
|
|
81
172
|
`config_unknown_key`, and a rejected value produces `config_invalid_value`. Use
|
|
82
173
|
`docbridge init --dry-run` to inspect a safe generated starting point without
|
|
83
174
|
overwriting an existing file.
|
|
175
|
+
|
|
176
|
+
Next, read `docbridge docs show linking` to add the first links, or
|
|
177
|
+
`docbridge docs show commands` to choose how to check them.
|
package/docs/user/linking.md
CHANGED
|
@@ -7,13 +7,22 @@ description: Choose, create, and semantically review @doc and @code links.
|
|
|
7
7
|
DocBridge connects supported code declarations to Markdown headings. This
|
|
8
8
|
guide covers the complete workflow: choose meaningful sections, create a
|
|
9
9
|
reciprocal annotation pair, and review whether the relationship is still true.
|
|
10
|
+
The exact contracts are in the
|
|
11
|
+
[Annotations](https://github.com/salan70/docbridge/blob/main/docs/specs/annotations.md),
|
|
12
|
+
[Link resolution](https://github.com/salan70/docbridge/blob/main/docs/specs/link-resolution.md),
|
|
13
|
+
and [Link manifest](https://github.com/salan70/docbridge/blob/main/docs/specs/link-manifest.md)
|
|
14
|
+
specifications.
|
|
10
15
|
|
|
11
16
|
## Choose what to link
|
|
12
17
|
|
|
13
18
|
Prefer sections that define behavior, contracts, inputs and outputs,
|
|
14
|
-
constraints, user-visible behavior, or design decisions. README
|
|
15
|
-
changelogs, contribution guides, runbooks,
|
|
16
|
-
|
|
19
|
+
constraints, user-visible behavior, or design decisions. Do not link README
|
|
20
|
+
files, changelogs, contribution guides, runbooks, or release notes unless a
|
|
21
|
+
specific section acts as an enduring specification. `docbridge init` skips
|
|
22
|
+
conventional files such as `README.md`, `CHANGELOG.md`, and `CONTRIBUTING.md`
|
|
23
|
+
when it chooses a documentation directory. DocBridge still scans every
|
|
24
|
+
Markdown file that the configured `docs` patterns match, including a proposed
|
|
25
|
+
`docs/**/*.md`, so narrow the patterns to keep these files out of the graph.
|
|
17
26
|
|
|
18
27
|
Prefer supported public API declarations as code targets. Do not force a link
|
|
19
28
|
when no declaration implements or represents the section, and do not use link
|
|
@@ -79,17 +88,44 @@ pub fn login(email: &str, password: &str) {}
|
|
|
79
88
|
func Login(email, password string) error { return nil }
|
|
80
89
|
```
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
```js
|
|
92
|
+
/** @doc docs/auth.md#login-flow */
|
|
93
|
+
export function login(email, password) {}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
def login(email: str, password: str) -> None:
|
|
98
|
+
"""Start the login flow.
|
|
99
|
+
|
|
100
|
+
@doc docs/auth.md#login-flow
|
|
101
|
+
"""
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```ruby
|
|
105
|
+
# @doc docs/auth.md#login-flow
|
|
106
|
+
def login(email, password); end
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```java
|
|
110
|
+
/** @doc docs/auth.md#login-flow */
|
|
111
|
+
public void login(String email, char[] password) {}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Paths are relative to the configured root. An annotation on an unsupported
|
|
115
|
+
declaration, or on a TypeScript, JavaScript, Python, Ruby, or Java declaration
|
|
116
|
+
excluded by visibility, produces `unsupported_declaration`; the same
|
|
117
|
+
declaration without an annotation is ignored. Swift, Dart, Rust, and Go ignore
|
|
118
|
+
an annotation on a declaration excluded by visibility without a diagnostic. To link such a declaration, add
|
|
119
|
+
its tier to `visibility` where the language accepts one; Dart accepts only
|
|
120
|
+
`public`, so a private Dart declaration cannot be linked.
|
|
85
121
|
|
|
86
122
|
### TypeScript declarations
|
|
87
123
|
|
|
88
124
|
Supported top-level exported forms include functions, classes, interfaces,
|
|
89
|
-
type aliases, enums, and single-declarator
|
|
90
|
-
`declare` and named default forms. Supported members
|
|
91
|
-
properties, accessors, constructors, and static members;
|
|
92
|
-
and members of object-literal type aliases.
|
|
125
|
+
type aliases, enums, and single-declarator variables (`const`, `let`, or
|
|
126
|
+
`var`), including supported `declare` and named default forms. Supported members
|
|
127
|
+
include class methods, properties, accessors, constructors, and static members;
|
|
128
|
+
interface members; and members of object-literal type aliases.
|
|
93
129
|
|
|
94
130
|
Members use type-qualified IDs without parameter signatures, such as
|
|
95
131
|
`AuthService.login` and `AuthService.constructor`. Visibility defaults to
|
|
@@ -140,6 +176,66 @@ clause, imports, `init`, and `_` are not endpoints. The scanner is syntactic:
|
|
|
140
176
|
`_test.go` files and `//go:build`-constrained files are scanned whenever the
|
|
141
177
|
patterns match them.
|
|
142
178
|
|
|
179
|
+
### JavaScript declarations
|
|
180
|
+
|
|
181
|
+
JavaScript follows the TypeScript rules for the forms an ES module can
|
|
182
|
+
express: exported functions, classes, and single-declarator variables, named
|
|
183
|
+
default exports, and the members of exported classes, with the same JSDoc
|
|
184
|
+
comments and IDs such as `AuthService.login`. Every member is `public`;
|
|
185
|
+
`#private` members are not endpoints. CommonJS assignments such as
|
|
186
|
+
`module.exports = ...` and `exports.name = ...` are not endpoints, so an
|
|
187
|
+
`@doc` on one is `unsupported_declaration`. JSX parses in every JavaScript
|
|
188
|
+
file. TypeScript-only syntax, such as an `interface`, a `type` alias, or a type
|
|
189
|
+
annotation, is a syntax error in a JavaScript file and is reported as
|
|
190
|
+
`code_parse_error`; JSDoc types stay valid.
|
|
191
|
+
|
|
192
|
+
### Python declarations
|
|
193
|
+
|
|
194
|
+
Supported forms are module-level functions and classes, and the methods and
|
|
195
|
+
nested classes of a class, including those under `if`, `try`, and `with`
|
|
196
|
+
blocks; nothing inside a function body is an endpoint. Put `@doc` in the
|
|
197
|
+
docstring or in the `#` comment block directly above the declaration or its
|
|
198
|
+
first decorator. IDs are dot-qualified, such as `AuthService.login`. A
|
|
199
|
+
property's getter, setter, and deleter share one endpoint, as do `@overload`
|
|
200
|
+
stubs and their implementation. A name that starts with `_`, other than a
|
|
201
|
+
`__dunder__` name, is `private`, and so is every member of a private class.
|
|
202
|
+
Module docstrings, assignments, and nested functions are not endpoints.
|
|
203
|
+
|
|
204
|
+
### Ruby declarations
|
|
205
|
+
|
|
206
|
+
Supported forms are classes, modules, constants, instance methods, singleton
|
|
207
|
+
methods (`def self.x` and `def x` inside `class << self`), and top-level
|
|
208
|
+
methods. Put `@doc` in the `#` comment block directly above the declaration.
|
|
209
|
+
IDs use `::` between constants and `.` before a method name, such as
|
|
210
|
+
`Auth::Service`, `Auth::MAX_ATTEMPTS`, `Auth::Service.login`, and
|
|
211
|
+
`Auth::Service.self.build` for a singleton method. A class reopened in the same
|
|
212
|
+
file is one endpoint. Bare `private`, `protected`, and `public` calls,
|
|
213
|
+
`private def x`, and `private_class_method` set method visibility; classes,
|
|
214
|
+
modules, and constants are always `public`. `attr_reader` and its siblings,
|
|
215
|
+
`alias`, and `define_method` are not endpoints.
|
|
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
|
+
|
|
143
239
|
<!-- @code src/scan/markdown/markdown.ts#scanMarkdown -->
|
|
144
240
|
|
|
145
241
|
## Documentation to code
|
|
@@ -14,8 +14,8 @@ stderr. Use `docbridge <command> --help` for invocation errors and
|
|
|
14
14
|
(for example, the path is a directory or lacks read permission), or is not
|
|
15
15
|
valid JSON. The message says the file was not found in both of the first two
|
|
16
16
|
cases. Run `docbridge init --dry-run` when the file is missing. When the path
|
|
17
|
-
exists, make it a readable file with valid JSON, or remove it
|
|
18
|
-
`check` again.
|
|
17
|
+
exists, make it a readable file with valid JSON, or remove it and create a new
|
|
18
|
+
one with `docbridge init`, before running `check` again.
|
|
19
19
|
|
|
20
20
|
`config_unknown_key` means a parsed file has a key DocBridge does not know,
|
|
21
21
|
such as a misspelled property. `config_invalid_value` means a known key has a
|
|
@@ -36,14 +36,31 @@ 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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
51
|
+
the override instead of installing another one.
|
|
43
52
|
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
`code_scanner_failed` diagnostics contain the worker failure rather than
|
|
54
|
+
converting it into a broken link. One worker run scans every file of its
|
|
55
|
+
language, so a failed run reports the same message on each of those files.
|
|
56
|
+
Check that the source parses with the project's own toolchain, then reproduce
|
|
57
|
+
with the smallest configured file set.
|
|
58
|
+
|
|
59
|
+
`code_parse_error` means a TypeScript, JavaScript, Swift, Dart, Rust, Go,
|
|
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
|
|
47
64
|
from that file, so fix the syntax before judging link diagnostics that involve
|
|
48
65
|
it. Unlike
|
|
49
66
|
`code_scanner_failed`, the worker ran correctly; the source itself did not
|
package/package.json
CHANGED
|
@@ -44,7 +44,17 @@
|
|
|
44
44
|
"target": { "type": "string" },
|
|
45
45
|
"language": {
|
|
46
46
|
"type": "string",
|
|
47
|
-
"enum": [
|
|
47
|
+
"enum": [
|
|
48
|
+
"typescript",
|
|
49
|
+
"swift",
|
|
50
|
+
"dart",
|
|
51
|
+
"rust",
|
|
52
|
+
"go",
|
|
53
|
+
"javascript",
|
|
54
|
+
"python",
|
|
55
|
+
"ruby",
|
|
56
|
+
"java"
|
|
57
|
+
]
|
|
48
58
|
},
|
|
49
59
|
"source": { "type": "string" },
|
|
50
60
|
"message": { "type": "string" },
|
|
@@ -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": {
|
|
@@ -22,7 +22,11 @@
|
|
|
22
22
|
"swift": { "$ref": "#/$defs/swiftEntry" },
|
|
23
23
|
"dart": { "$ref": "#/$defs/dartEntry" },
|
|
24
24
|
"rust": { "$ref": "#/$defs/rustEntry" },
|
|
25
|
-
"go": { "$ref": "#/$defs/goEntry" }
|
|
25
|
+
"go": { "$ref": "#/$defs/goEntry" },
|
|
26
|
+
"javascript": { "$ref": "#/$defs/javascriptEntry" },
|
|
27
|
+
"python": { "$ref": "#/$defs/pythonEntry" },
|
|
28
|
+
"ruby": { "$ref": "#/$defs/rubyEntry" },
|
|
29
|
+
"java": { "$ref": "#/$defs/javaEntry" }
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
32
|
"docs": {
|
|
@@ -34,9 +38,33 @@
|
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
}
|
|
41
|
+
},
|
|
42
|
+
"scanners": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"additionalProperties": false,
|
|
45
|
+
"properties": {
|
|
46
|
+
"python": { "$ref": "#/$defs/scannerRuntime" },
|
|
47
|
+
"ruby": { "$ref": "#/$defs/scannerRuntime" },
|
|
48
|
+
"java": { "$ref": "#/$defs/scannerRuntime" }
|
|
49
|
+
}
|
|
37
50
|
}
|
|
38
51
|
},
|
|
39
52
|
"$defs": {
|
|
53
|
+
"scannerRuntime": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": false,
|
|
56
|
+
"required": ["command"],
|
|
57
|
+
"properties": {
|
|
58
|
+
"command": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"minItems": 1,
|
|
61
|
+
"items": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"minLength": 1
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
40
68
|
"typescriptEntry": {
|
|
41
69
|
"type": "object",
|
|
42
70
|
"additionalProperties": false,
|
|
@@ -47,7 +75,7 @@
|
|
|
47
75
|
"minItems": 1,
|
|
48
76
|
"items": {
|
|
49
77
|
"type": "string",
|
|
50
|
-
"pattern": "^(?!.*\\.d\\.ts$).*\\.ts$"
|
|
78
|
+
"pattern": "^(?!.*\\.d\\.[cm]?ts$).*\\.(ts|tsx|mts|cts)$"
|
|
51
79
|
}
|
|
52
80
|
},
|
|
53
81
|
"visibility": {
|
|
@@ -146,6 +174,94 @@
|
|
|
146
174
|
}
|
|
147
175
|
}
|
|
148
176
|
}
|
|
177
|
+
},
|
|
178
|
+
"javascriptEntry": {
|
|
179
|
+
"type": "object",
|
|
180
|
+
"additionalProperties": false,
|
|
181
|
+
"required": ["patterns"],
|
|
182
|
+
"properties": {
|
|
183
|
+
"patterns": {
|
|
184
|
+
"type": "array",
|
|
185
|
+
"minItems": 1,
|
|
186
|
+
"items": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"pattern": "\\.(js|jsx|mjs|cjs)$"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"visibility": {
|
|
192
|
+
"type": "array",
|
|
193
|
+
"items": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"enum": ["public", "protected", "private"]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"pythonEntry": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"additionalProperties": false,
|
|
203
|
+
"required": ["patterns"],
|
|
204
|
+
"properties": {
|
|
205
|
+
"patterns": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"minItems": 1,
|
|
208
|
+
"items": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"pattern": "\\.py$"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"visibility": {
|
|
214
|
+
"type": "array",
|
|
215
|
+
"items": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"enum": ["public", "private"]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"rubyEntry": {
|
|
223
|
+
"type": "object",
|
|
224
|
+
"additionalProperties": false,
|
|
225
|
+
"required": ["patterns"],
|
|
226
|
+
"properties": {
|
|
227
|
+
"patterns": {
|
|
228
|
+
"type": "array",
|
|
229
|
+
"minItems": 1,
|
|
230
|
+
"items": {
|
|
231
|
+
"type": "string",
|
|
232
|
+
"pattern": "\\.rb$"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"visibility": {
|
|
236
|
+
"type": "array",
|
|
237
|
+
"items": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"enum": ["public", "protected", "private"]
|
|
240
|
+
}
|
|
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
|
+
}
|
|
149
265
|
}
|
|
150
266
|
}
|
|
151
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" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: docbridge
|
|
3
|
-
description: Adopt or introduce DocBridge, choose docs and code scope, create or improve docbridge.config.json, add @doc and @code annotations, fix link diagnostics, triage related --gate findings, and review existing links for stale docs or semantic validity.
|
|
3
|
+
description: Adopt or introduce DocBridge, choose docs and code scope, create or improve docbridge.config.json, add @doc and @code annotations or docbridge.links.json entries, fix link diagnostics, triage related --gate findings, and review existing links for stale docs or semantic validity.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# docbridge
|
|
@@ -22,7 +22,7 @@ Pick **one** job before editing. The first matching question wins:
|
|
|
22
22
|
| ----------------- | ------------------------------------------------------------------------------ | --------------------------------------------- |
|
|
23
23
|
| Adopt | Introduce DocBridge, choose docs/code scope, or write `docbridge.config.json`? | Linking existing files |
|
|
24
24
|
| Discover and link | Choose what to link in existing docs, docs-first? | A known pair already confirmed |
|
|
25
|
-
| Annotate | Add or fix a `@doc` / `@code` pair, or clear
|
|
25
|
+
| Annotate | Add or fix a `@doc` / `@code` pair or a manifest entry, or clear diagnostics? | Deciding _whether_ a section should be linked |
|
|
26
26
|
| Review | Check whether the docs still match the code, with no change set? | Gate findings on a diff |
|
|
27
27
|
| Sync | A Git hook, CI comment, or `related --gate` flagged unchanged counterparts? | Auditing the whole graph |
|
|
28
28
|
|
|
@@ -73,6 +73,16 @@ no diagnostic mentions either endpoint.
|
|
|
73
73
|
Do not split or rename headings in this job. Preserve existing annotations
|
|
74
74
|
unless the user asked to fix a wrong link.
|
|
75
75
|
|
|
76
|
+
### Manifest links
|
|
77
|
+
|
|
78
|
+
Use `docbridge.links.json` when the project already declares links there, or
|
|
79
|
+
when the user does not accept markers in a file. Read
|
|
80
|
+
`docbridge docs show linking` for its format. Add one entry per link with the
|
|
81
|
+
same `code` and `doc` targets an annotation pair would use; never declare a
|
|
82
|
+
link that an annotation pair already provides. Fix `code_symbol_not_found` with
|
|
83
|
+
the printed suggestion only after confirming it names the intended symbol.
|
|
84
|
+
Verify with `docbridge check`.
|
|
85
|
+
|
|
76
86
|
## Sync
|
|
77
87
|
|
|
78
88
|
A `related --gate` violation means nobody has decided yet, not that the
|