docbridge 0.10.1 → 0.12.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +74 -1
  2. package/README.md +16 -9
  3. package/dist/bin/darwin-arm64/SHA256SUMS +3 -2
  4. package/dist/bin/darwin-arm64/docbridge-go-scanner +0 -0
  5. package/dist/bin/darwin-arm64/docbridge-swift-scanner +0 -0
  6. package/dist/bin/darwin-arm64/docbridge_dart_scanner +0 -0
  7. package/dist/bin/linux-x64/SHA256SUMS +3 -2
  8. package/dist/bin/linux-x64/docbridge-go-scanner +0 -0
  9. package/dist/bin/linux-x64/docbridge-swift-scanner +1 -1
  10. package/dist/bin/linux-x64/docbridge_dart_scanner +0 -0
  11. package/dist/index.js +1773 -668
  12. package/dist/workers/java/docbridge-java-scanner.jar +0 -0
  13. package/dist/workers/python/docbridge_python_scanner/__init__.py +6 -0
  14. package/dist/workers/python/docbridge_python_scanner/comments.py +177 -0
  15. package/dist/workers/python/docbridge_python_scanner/declarations.py +318 -0
  16. package/dist/workers/python/docbridge_python_scanner/links.py +62 -0
  17. package/dist/workers/python/docbridge_python_scanner/positions.py +75 -0
  18. package/dist/workers/python/docbridge_python_scanner/protocol.py +105 -0
  19. package/dist/workers/python/docbridge_python_scanner/scanner.py +214 -0
  20. package/dist/workers/python/docbridge_python_scanner.py +16 -0
  21. package/dist/workers/ruby/bin/docbridge-ruby-scanner +10 -0
  22. package/dist/workers/ruby/lib/docbridge_ruby_scanner/cli.rb +30 -0
  23. package/dist/workers/ruby/lib/docbridge_ruby_scanner/comments.rb +55 -0
  24. package/dist/workers/ruby/lib/docbridge_ruby_scanner/compat.rb +39 -0
  25. package/dist/workers/ruby/lib/docbridge_ruby_scanner/declarations.rb +230 -0
  26. package/dist/workers/ruby/lib/docbridge_ruby_scanner/links.rb +38 -0
  27. package/dist/workers/ruby/lib/docbridge_ruby_scanner/positions.rb +50 -0
  28. package/dist/workers/ruby/lib/docbridge_ruby_scanner/probe.rb +28 -0
  29. package/dist/workers/ruby/lib/docbridge_ruby_scanner/protocol.rb +161 -0
  30. package/dist/workers/ruby/lib/docbridge_ruby_scanner.rb +21 -0
  31. package/docs/README.md +10 -3
  32. package/docs/user/automation.md +8 -4
  33. package/docs/user/commands.md +11 -3
  34. package/docs/user/configuration.md +105 -13
  35. package/docs/user/getting-started.md +1 -1
  36. package/docs/user/linking.md +105 -10
  37. package/docs/user/troubleshooting.md +23 -10
  38. package/package.json +1 -1
  39. package/schemas/common-output.schema.json +11 -1
  40. package/schemas/context-output.schema.json +1 -1
  41. package/schemas/docbridge.schema.json +118 -2
  42. package/schemas/graph-output.schema.json +1 -1
  43. package/schemas/scanner-worker.schema.json +1 -1
  44. 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,23 +35,104 @@ Declare documentation patterns and at least one supported code language:
33
35
  }
34
36
  ```
35
37
 
36
- Supported language keys are `typescript`, `swift`, `dart`, and `rust`. A project can
37
- enable more than one language, each with its own patterns.
38
+ Other languages use the same shape under their own key. A Go project that
39
+ documents its `internal` packages:
38
40
 
39
- Each language accepts an optional `visibility` array. Omitting it uses the
40
- scanner default: TypeScript `public` and `protected` members, Swift `public`
41
- and `open`, Dart `public` only, Rust unrestricted `pub`. A declaration
42
- excluded by visibility is not an endpoint; an `@doc` on one is
43
- `unsupported_declaration`. See `docbridge docs show linking` for the
44
- per-language rules, including Dart's leading-underscore privacy.
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
+ ```
54
+
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
+
71
+ Patterns must end with one of the language's extensions. The npm package
72
+ bundles the Swift, Dart, Rust, and Go scanners for `darwin-arm64` and
73
+ `linux-x64`; TypeScript, JavaScript, and Markdown need no scanner binary.
74
+ Python and Ruby are scanned by scripts in the package that run on the
75
+ interpreter installed on the machine, on any platform; see
76
+ [Scanner runtimes](#scanner-runtimes).
77
+
78
+ Each language accepts an optional `visibility` array; omitting it uses the
79
+ default above. TypeScript and JavaScript `visibility` applies only to class and
80
+ type members; top-level declarations must be exported, and every JavaScript
81
+ member is `public`. Rust `pub` means unrestricted `pub`, and `private` covers
82
+ every narrower visibility. A declaration excluded by visibility is not an
83
+ endpoint. An `@doc` on an excluded TypeScript or JavaScript member, or on an
84
+ excluded Python or Ruby declaration, is `unsupported_declaration`; the Swift,
85
+ Dart, Rust, and Go scanners ignore an `@doc` on an excluded declaration
86
+ without a diagnostic. See `docbridge docs show linking` for the per-language
87
+ declaration rules, including Dart's and Python's leading-underscore privacy,
88
+ Go's exported-name rule for methods, and Ruby's `private` calls. The
89
+ [Scanning specification](https://github.com/salan70/docbridge/blob/main/docs/specs/scanning.md)
90
+ owns the exact scanner behavior and platform keys.
91
+
92
+ <!-- @code src/config/scanner-runtimes.ts#ScannerRuntimes -->
93
+
94
+ ## Scanner runtimes
95
+
96
+ Python and Ruby files are scanned by scripts that run on an interpreter
97
+ installed on the machine: CPython 3.10 or later, and CRuby 3.3 or later, whose
98
+ bundled Prism parses the source. DocBridge looks for `python3`, then `python`
99
+ (`py -3`, then `python` on Windows), and for `ruby` on `PATH`, and checks each
100
+ candidate before using it. The scripts never import or run project code.
101
+
102
+ To use another interpreter, name it under `scanners`:
103
+
104
+ ```json
105
+ {
106
+ "include": {
107
+ "code": { "python": { "patterns": ["src/**/*.py"] } },
108
+ "docs": ["docs/**/*.md"]
109
+ },
110
+ "scanners": {
111
+ "python": { "command": ["/opt/python3.12/bin/python3"] }
112
+ }
113
+ }
114
+ ```
115
+
116
+ `command` is the interpreter followed by its own arguments, as an array rather
117
+ than a shell string; a relative path resolves against the project root.
118
+ Without a configured command, the environment variable
119
+ `DOCBRIDGE_PYTHON_RUNTIME` or `DOCBRIDGE_RUBY_RUNTIME` can name one
120
+ interpreter executable instead. A configured command or variable is the only
121
+ interpreter tried: when it is missing or unusable, the files report
122
+ `code_scanner_unavailable` instead of falling back to `PATH`.
123
+
124
+ A configured command runs with your permissions in the CLI and in the editor
125
+ extension. Review `scanners` in a repository you do not trust before running
126
+ DocBridge there.
45
127
 
46
128
  <!-- @code src/shared/glob.ts#collectFiles -->
129
+ <!-- @code src/config/code-language.ts#collectCodeFiles -->
47
130
 
48
131
  ## Excluded files
49
132
 
50
- The configuration has no `exclude` property. Narrow the include patterns when
51
- tests, fixtures, generated files, or general documentation should stay outside
52
- the graph:
133
+ The configuration has no `exclude` property and no glob negation. Narrow the
134
+ positive include patterns when tests, fixtures, generated files, or general
135
+ documentation should stay outside the graph:
53
136
 
54
137
  ```json
55
138
  {
@@ -64,8 +147,14 @@ the graph:
64
147
  }
65
148
  ```
66
149
 
150
+ For Go, `cmd/**/*.go` and `internal/**/*.go` scan fewer files than
151
+ `**/*.go`, but `_test.go` files under them are still scanned. For Python and
152
+ Ruby, keep test directories such as `tests/` and `spec/` outside the patterns
153
+ in the same way.
154
+
67
155
  DocBridge always ignores dependency directories, Git metadata, dot-prefixed
68
- path segments, symbolic links, and TypeScript declaration files (`.d.ts`).
156
+ path segments, symbolic links, and TypeScript declaration files (`.d.ts`,
157
+ `.d.mts`, and `.d.cts`).
69
158
  Keep patterns narrow enough that `docbridge check --audit` reports useful
70
159
  coverage gaps rather than every implementation detail or general prose file.
71
160
 
@@ -76,3 +165,6 @@ file, or invalid JSON, produces `config_file_invalid`. An unknown key produces
76
165
  `config_unknown_key`, and a rejected value produces `config_invalid_value`. Use
77
166
  `docbridge init --dry-run` to inspect a safe generated starting point without
78
167
  overwriting an existing file.
168
+
169
+ Next, read `docbridge docs show linking` to add the first links, or
170
+ `docbridge docs show commands` to choose how to check them.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Set up DocBridge in an existing TypeScript, Swift, Dart, or Rust project.
2
+ description: Set up DocBridge in an existing TypeScript, JavaScript, Swift, Dart, Rust, Go, Python, or Ruby project.
3
3
  ---
4
4
 
5
5
  # Getting Started
@@ -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 files,
15
- changelogs, contribution guides, runbooks, and release notes are excluded by
16
- default unless a specific section acts as an enduring specification.
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
@@ -72,17 +81,46 @@ void login(String email, String password) {}
72
81
  pub fn login(email: &str, password: &str) {}
73
82
  ```
74
83
 
75
- Paths are relative to the configured root. An annotation on an unsupported or
76
- visibility-excluded declaration produces `unsupported_declaration`; the same
77
- declaration without an annotation is ignored.
84
+ ```go
85
+ // Login starts the login flow.
86
+ //
87
+ // @doc docs/auth.md#login-flow
88
+ func Login(email, password string) error { return nil }
89
+ ```
90
+
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
+ Paths are relative to the configured root. An annotation on an unsupported
110
+ declaration, or on a TypeScript, JavaScript, Python, or Ruby declaration
111
+ excluded by visibility, produces `unsupported_declaration`; the same
112
+ declaration without an annotation is ignored. Swift, Dart, Rust, and Go ignore
113
+ an annotation on a declaration excluded by visibility without a diagnostic. To link such a declaration, add
114
+ its tier to `visibility` where the language accepts one; Dart accepts only
115
+ `public`, so a private Dart declaration cannot be linked.
78
116
 
79
117
  ### TypeScript declarations
80
118
 
81
119
  Supported top-level exported forms include functions, classes, interfaces,
82
- type aliases, enums, and single-declarator constants, including supported
83
- `declare` and named default forms. Supported members include class methods,
84
- properties, accessors, constructors, and static members; interface members;
85
- and members of object-literal type aliases.
120
+ type aliases, enums, and single-declarator variables (`const`, `let`, or
121
+ `var`), including supported `declare` and named default forms. Supported members
122
+ include class methods, properties, accessors, constructors, and static members;
123
+ interface members; and members of object-literal type aliases.
86
124
 
87
125
  Members use type-qualified IDs without parameter signatures, such as
88
126
  `AuthService.login` and `AuthService.constructor`. Visibility defaults to
@@ -114,6 +152,63 @@ to include non-`pub` items. Trait definitions and implementations, macros,
114
152
  constants, statics, unions, and extern blocks are not endpoints. IDs use `::`
115
153
  qualification, such as `TypingEngine::advance`.
116
154
 
155
+ ### Go declarations
156
+
157
+ Supported forms are package-level functions, types (including aliases),
158
+ constants, and variables, plus receiver methods and interface methods. The
159
+ annotation goes in the declaration's doc comment, as `//` lines or one
160
+ `/* */` block. Visibility defaults to `exported`; configure `unexported` to
161
+ include unexported names. A method counts as exported only when both its name
162
+ and its receiver or interface type name are exported. IDs use `.`
163
+ qualification without type parameters, such as `AuthService.Login` and
164
+ `List.Push` for `func (l *List[T]) Push`.
165
+
166
+ Inside a `const (`, `var (`, or `type (` group, annotate the individual spec;
167
+ an `@doc` in the comment above the group keyword, or above a spec that
168
+ declares several names (`var a, b int`), is `unsupported_declaration` because
169
+ it cannot name one endpoint. Struct fields, embedded fields, the `package`
170
+ clause, imports, `init`, and `_` are not endpoints. The scanner is syntactic:
171
+ `_test.go` files and `//go:build`-constrained files are scanned whenever the
172
+ patterns match them.
173
+
174
+ ### JavaScript declarations
175
+
176
+ JavaScript follows the TypeScript rules for the forms an ES module can
177
+ express: exported functions, classes, and single-declarator variables, named
178
+ default exports, and the members of exported classes, with the same JSDoc
179
+ comments and IDs such as `AuthService.login`. Every member is `public`;
180
+ `#private` members are not endpoints. CommonJS assignments such as
181
+ `module.exports = ...` and `exports.name = ...` are not endpoints, so an
182
+ `@doc` on one is `unsupported_declaration`. JSX parses in every JavaScript
183
+ file. TypeScript-only syntax, such as an `interface`, a `type` alias, or a type
184
+ annotation, is a syntax error in a JavaScript file and is reported as
185
+ `code_parse_error`; JSDoc types stay valid.
186
+
187
+ ### Python declarations
188
+
189
+ Supported forms are module-level functions and classes, and the methods and
190
+ nested classes of a class, including those under `if`, `try`, and `with`
191
+ blocks; nothing inside a function body is an endpoint. Put `@doc` in the
192
+ docstring or in the `#` comment block directly above the declaration or its
193
+ first decorator. IDs are dot-qualified, such as `AuthService.login`. A
194
+ property's getter, setter, and deleter share one endpoint, as do `@overload`
195
+ stubs and their implementation. A name that starts with `_`, other than a
196
+ `__dunder__` name, is `private`, and so is every member of a private class.
197
+ Module docstrings, assignments, and nested functions are not endpoints.
198
+
199
+ ### Ruby declarations
200
+
201
+ Supported forms are classes, modules, constants, instance methods, singleton
202
+ methods (`def self.x` and `def x` inside `class << self`), and top-level
203
+ methods. Put `@doc` in the `#` comment block directly above the declaration.
204
+ IDs use `::` between constants and `.` before a method name, such as
205
+ `Auth::Service`, `Auth::MAX_ATTEMPTS`, `Auth::Service.login`, and
206
+ `Auth::Service.self.build` for a singleton method. A class reopened in the same
207
+ file is one endpoint. Bare `private`, `protected`, and `public` calls,
208
+ `private def x`, and `private_class_method` set method visibility; classes,
209
+ modules, and constants are always `public`. `attr_reader` and its siblings,
210
+ `alias`, and `define_method` are not endpoints.
211
+
117
212
  <!-- @code src/scan/markdown/markdown.ts#scanMarkdown -->
118
213
 
119
214
  ## 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, before running
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
@@ -30,20 +30,33 @@ delete it. See [Linking](linking.md) for its format.
30
30
 
31
31
  ## Scanner errors
32
32
 
33
- Swift, Dart, and Rust use packaged scanner workers. A
33
+ Swift, Dart, Rust, and Go use packaged scanner workers. A
34
34
  `code_scanner_unavailable` diagnostic usually means the installed package
35
35
  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
- `code_scanner_failed` diagnostics contain the worker failure rather than
40
- converting it into a broken link. Check that the source parses with the
41
- project's own toolchain, then reproduce with the smallest configured file
42
- set.
39
+ Python and Ruby run on the interpreter installed on the machine. For them,
40
+ `code_scanner_unavailable` names the interpreter DocBridge needs, the minimum
41
+ version, and what it found for each candidate: no interpreter on `PATH`, a
42
+ version below CPython 3.10 or CRuby 3.3, or a Ruby whose bundled Prism does not
43
+ load. Install a supported version on `PATH`, or point `scanners.python.command`
44
+ or `scanners.ruby.command` in the configuration, or `DOCBRIDGE_PYTHON_RUNTIME`
45
+ or `DOCBRIDGE_RUBY_RUNTIME` in the environment, at one; see
46
+ [Configuration](configuration.md#scanner-runtimes). When the message names
47
+ one of those overrides, DocBridge tried only that interpreter, so fix or remove
48
+ the override instead of installing another one.
43
49
 
44
- `code_parse_error` means a TypeScript, Swift, Dart, or Rust source file has a
45
- syntax error. The diagnostic points at the first error the language's parser
46
- found and includes the parser's message. DocBridge extracts no links or symbols
50
+ `code_scanner_failed` diagnostics contain the worker failure rather than
51
+ converting it into a broken link. One worker run scans every file of its
52
+ language, so a failed run reports the same message on each of those files.
53
+ Check that the source parses with the project's own toolchain, then reproduce
54
+ with the smallest configured file set.
55
+
56
+ `code_parse_error` means a TypeScript, JavaScript, Swift, Dart, Rust, Go,
57
+ Python, or Ruby source file has a syntax error. The diagnostic points at the
58
+ first error the language's parser found and includes the parser's message; for
59
+ Python and Ruby, the wording comes from the installed interpreter. DocBridge extracts no links or symbols
47
60
  from that file, so fix the syntax before judging link diagnostics that involve
48
61
  it. Unlike
49
62
  `code_scanner_failed`, the worker ran correctly; the source itself did not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docbridge",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "description": "A CLI that links Markdown specifications and code declarations. Runs on Node.js and Bun.",
5
5
  "keywords": [
6
6
  "bun",
@@ -44,7 +44,17 @@
44
44
  "target": { "type": "string" },
45
45
  "language": {
46
46
  "type": "string",
47
- "enum": ["typescript", "swift", "dart", "rust"]
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,7 @@
35
35
  },
36
36
  "language": {
37
37
  "type": "string",
38
- "enum": ["typescript", "swift", "dart", "rust"],
38
+ "enum": ["typescript", "swift", "dart", "rust", "go", "javascript", "python", "ruby"],
39
39
  "description": "Code language for code context blocks."
40
40
  },
41
41
  "startLine": {
@@ -21,7 +21,11 @@
21
21
  "typescript": { "$ref": "#/$defs/typescriptEntry" },
22
22
  "swift": { "$ref": "#/$defs/swiftEntry" },
23
23
  "dart": { "$ref": "#/$defs/dartEntry" },
24
- "rust": { "$ref": "#/$defs/rustEntry" }
24
+ "rust": { "$ref": "#/$defs/rustEntry" },
25
+ "go": { "$ref": "#/$defs/goEntry" },
26
+ "javascript": { "$ref": "#/$defs/javascriptEntry" },
27
+ "python": { "$ref": "#/$defs/pythonEntry" },
28
+ "ruby": { "$ref": "#/$defs/rubyEntry" }
25
29
  }
26
30
  },
27
31
  "docs": {
@@ -33,9 +37,33 @@
33
37
  }
34
38
  }
35
39
  }
40
+ },
41
+ "scanners": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "properties": {
45
+ "python": { "$ref": "#/$defs/scannerRuntime" },
46
+ "ruby": { "$ref": "#/$defs/scannerRuntime" },
47
+ "java": { "$ref": "#/$defs/scannerRuntime" }
48
+ }
36
49
  }
37
50
  },
38
51
  "$defs": {
52
+ "scannerRuntime": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["command"],
56
+ "properties": {
57
+ "command": {
58
+ "type": "array",
59
+ "minItems": 1,
60
+ "items": {
61
+ "type": "string",
62
+ "minLength": 1
63
+ }
64
+ }
65
+ }
66
+ },
39
67
  "typescriptEntry": {
40
68
  "type": "object",
41
69
  "additionalProperties": false,
@@ -46,7 +74,7 @@
46
74
  "minItems": 1,
47
75
  "items": {
48
76
  "type": "string",
49
- "pattern": "^(?!.*\\.d\\.ts$).*\\.ts$"
77
+ "pattern": "^(?!.*\\.d\\.[cm]?ts$).*\\.(ts|tsx|mts|cts)$"
50
78
  }
51
79
  },
52
80
  "visibility": {
@@ -123,6 +151,94 @@
123
151
  }
124
152
  }
125
153
  }
154
+ },
155
+ "goEntry": {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "required": ["patterns"],
159
+ "properties": {
160
+ "patterns": {
161
+ "type": "array",
162
+ "minItems": 1,
163
+ "items": {
164
+ "type": "string",
165
+ "pattern": "\\.go$"
166
+ }
167
+ },
168
+ "visibility": {
169
+ "type": "array",
170
+ "items": {
171
+ "type": "string",
172
+ "enum": ["exported", "unexported"]
173
+ }
174
+ }
175
+ }
176
+ },
177
+ "javascriptEntry": {
178
+ "type": "object",
179
+ "additionalProperties": false,
180
+ "required": ["patterns"],
181
+ "properties": {
182
+ "patterns": {
183
+ "type": "array",
184
+ "minItems": 1,
185
+ "items": {
186
+ "type": "string",
187
+ "pattern": "\\.(js|jsx|mjs|cjs)$"
188
+ }
189
+ },
190
+ "visibility": {
191
+ "type": "array",
192
+ "items": {
193
+ "type": "string",
194
+ "enum": ["public", "protected", "private"]
195
+ }
196
+ }
197
+ }
198
+ },
199
+ "pythonEntry": {
200
+ "type": "object",
201
+ "additionalProperties": false,
202
+ "required": ["patterns"],
203
+ "properties": {
204
+ "patterns": {
205
+ "type": "array",
206
+ "minItems": 1,
207
+ "items": {
208
+ "type": "string",
209
+ "pattern": "\\.py$"
210
+ }
211
+ },
212
+ "visibility": {
213
+ "type": "array",
214
+ "items": {
215
+ "type": "string",
216
+ "enum": ["public", "private"]
217
+ }
218
+ }
219
+ }
220
+ },
221
+ "rubyEntry": {
222
+ "type": "object",
223
+ "additionalProperties": false,
224
+ "required": ["patterns"],
225
+ "properties": {
226
+ "patterns": {
227
+ "type": "array",
228
+ "minItems": 1,
229
+ "items": {
230
+ "type": "string",
231
+ "pattern": "\\.rb$"
232
+ }
233
+ },
234
+ "visibility": {
235
+ "type": "array",
236
+ "items": {
237
+ "type": "string",
238
+ "enum": ["public", "protected", "private"]
239
+ }
240
+ }
241
+ }
126
242
  }
127
243
  }
128
244
  }
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "language": {
33
33
  "type": "string",
34
- "enum": ["typescript", "swift", "dart", "rust"],
34
+ "enum": ["typescript", "swift", "dart", "rust", "go", "javascript", "python", "ruby"],
35
35
  "description": "Code language for code nodes."
36
36
  },
37
37
  "location": { "$ref": "common-output.schema.json#/$defs/location" },
@@ -7,7 +7,7 @@
7
7
  "$defs": {
8
8
  "language": {
9
9
  "type": "string",
10
- "enum": ["typescript", "swift", "dart", "rust"]
10
+ "enum": ["typescript", "swift", "dart", "rust", "go", "javascript", "python", "ruby", "java"]
11
11
  },
12
12
  "codeSymbol": {
13
13
  "type": "object",
@@ -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 link diagnostics? | Deciding _whether_ a section should be linked |
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