docbridge 0.10.1 → 0.11.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 CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.0] - 2026-09-30
11
+
12
+ ### Added
13
+
14
+ - Go is a first-party code language. Configure `include.code.go`, put `@doc`
15
+ in the doc comment of a package-level `func`, `type`, `const`, or `var`, a
16
+ receiver method, or an interface method, and link back with `@code`. The
17
+ bundled `docbridge-go-scanner` worker (same platforms as Swift, Dart, and
18
+ Rust) uses the Go standard library parser only. Visibility defaults to
19
+ `exported`; `unexported` opts in unexported names, and a method is exported
20
+ only when both its name and its receiver or interface type name are.
21
+ Canonical IDs use `Type.Method` without type parameters. An `@doc` above a
22
+ `const (` / `var (` / `type (` group keyword or above a spec that declares
23
+ several names is `unsupported_declaration`. The VS Code extension activates
24
+ for Go files, and `docbridge init` proposes the conventional `cmd/`,
25
+ `internal/`, and `pkg/` layout.
26
+
10
27
  ## [0.10.1] - 2026-09-28
11
28
 
12
29
  ### Fixed
@@ -452,7 +469,8 @@ Initial release of the SpecLink CLI.
452
469
  - `speclink check` command with `--root`, `--json`, and `--audit` options.
453
470
  - `speclink --version` (alias `-v`) and `speclink --help` (alias `-h`).
454
471
 
455
- [Unreleased]: https://github.com/salan70/docbridge/compare/v0.10.1...HEAD
472
+ [Unreleased]: https://github.com/salan70/docbridge/compare/v0.11.0...HEAD
473
+ [0.11.0]: https://github.com/salan70/docbridge/releases/tag/v0.11.0
456
474
  [0.10.1]: https://github.com/salan70/docbridge/releases/tag/v0.10.1
457
475
  [0.10.0]: https://github.com/salan70/docbridge/releases/tag/v0.10.0
458
476
  [0.9.0]: https://github.com/salan70/docbridge/releases/tag/v0.9.0
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
- Swift, Dart, and Rust declarations against `@code` annotations on Markdown
9
+ Swift, Dart, Rust, and Go declarations against `@code` annotations on Markdown
10
10
  headings, so humans and coding agents can find the right counterpart before a
11
11
  change drifts.
12
12
 
@@ -15,7 +15,7 @@ change drifts.
15
15
  - Node.js 22 or later, or Bun 1.1.31 or later
16
16
  - A project containing Markdown and supported source files
17
17
 
18
- Prebuilt Swift, Dart, and Rust scanners are included for supported macOS and
18
+ Prebuilt Swift, Dart, Rust, and Go scanners are included for supported macOS and
19
19
  Linux platforms. See [Releases](https://github.com/salan70/docbridge/releases)
20
20
  for packaged-platform details.
21
21
 
@@ -1,3 +1,4 @@
1
- 82a7bc7c1da1307a9e1f3a5a8fc0e8f82a72edb26c7293f6661a14d02448f11b docbridge-swift-scanner
2
- 1e7589065ce96bc1241458f6acc3b5d44a0a03866cbdf9125702cda84efcf267 docbridge_dart_scanner
1
+ 5db695997d6c32f0fd69722d43aabacd38b0ca67ce46f3f80160aff132d9b5d1 docbridge-swift-scanner
2
+ f0218c70949d7fae587d0e208cf9e959ff51fae4bceb7d60b92325c65723af37 docbridge_dart_scanner
3
3
  7fc3e6842b3e1bf425b8fd63e241eee7e64875f16be7ba8d1ae4a25baa7f2338 docbridge-rust-scanner
4
+ 2779c979bd91996bd0075afbed097fe7c9e2bf71ec331073a09b305e6a8ac510 docbridge-go-scanner
@@ -1,3 +1,4 @@
1
- f034659c6d4a146b09ac5b59571015517aa3aa541ec81a8d55eeb4ac696d1815 docbridge-swift-scanner
2
- 889403d7aee074e966e4112d761e97a1536f12ad4e76d93503ac31bd5ca7e3c7 docbridge_dart_scanner
1
+ ce42be3326a3c7fa127709edbca34056f9e5eda8af3dba1623b51a1c41050328 docbridge-swift-scanner
2
+ b75b14006ca792ed3ca8faf7ceee9e4d33c895f27dd416b640818cf8a4bdd9c8 docbridge_dart_scanner
3
3
  e0da7b8cc6ee23704f5fe8514cc309f0bb60380c77b55e3bc5ed113abd1f3478 docbridge-rust-scanner
4
+ 4b8b52ff6c806bdd7096afcce59fb05dcdf1cb27a3c5f0ffc8f1908a01085194 docbridge-go-scanner
@@ -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: f034659c6d4a146b09ac5b59571015517aa3aa541ec81a8d55eeb4ac696d1815
4
+ sha256: ce42be3326a3c7fa127709edbca34056f9e5eda8af3dba1623b51a1c41050328
package/dist/index.js CHANGED
@@ -175581,7 +175581,7 @@ import { join as join14, resolve as resolve4 } from "node:path";
175581
175581
  // package.json
175582
175582
  var package_default = {
175583
175583
  name: "docbridge",
175584
- version: "0.10.1",
175584
+ version: "0.11.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",
@@ -175787,7 +175787,8 @@ var KNOWN_CODE_LANGUAGES = [
175787
175787
  "typescript",
175788
175788
  "swift",
175789
175789
  "dart",
175790
- "rust"
175790
+ "rust",
175791
+ "go"
175791
175792
  ];
175792
175793
  function isCodeLanguage(value) {
175793
175794
  return KNOWN_CODE_LANGUAGES.includes(value);
@@ -175842,13 +175843,15 @@ var LANGUAGE_SUFFIX = {
175842
175843
  typescript: ".ts",
175843
175844
  swift: ".swift",
175844
175845
  dart: ".dart",
175845
- rust: ".rs"
175846
+ rust: ".rs",
175847
+ go: ".go"
175846
175848
  };
175847
175849
  var LANGUAGE_VISIBILITY = {
175848
175850
  typescript: ["public", "protected", "private"],
175849
175851
  swift: ["public", "open", "internal"],
175850
175852
  dart: ["public"],
175851
- rust: ["pub", "private"]
175853
+ rust: ["pub", "private"],
175854
+ go: ["exported", "unexported"]
175852
175855
  };
175853
175856
  function loadConfig(projectRoot) {
175854
175857
  let rawText;
@@ -176959,7 +176962,8 @@ var FENCE_LANGUAGE = {
176959
176962
  typescript: "ts",
176960
176963
  swift: "swift",
176961
176964
  dart: "dart",
176962
- rust: "rust"
176965
+ rust: "rust",
176966
+ go: "go"
176963
176967
  };
176964
176968
  var NESTED_BLOCK_COMMENTS = new Set(["swift", "dart", "rust"]);
176965
176969
  function withoutLeadingComments(text, language) {
@@ -178026,7 +178030,8 @@ var SUPPORTED_SCANNER_PLATFORM_KEYS = ["darwin-arm64", "linux-x64"];
178026
178030
  var SCANNER_EXECUTABLE_NAMES = {
178027
178031
  swift: "docbridge-swift-scanner",
178028
178032
  dart: "docbridge_dart_scanner",
178029
- rust: "docbridge-rust-scanner"
178033
+ rust: "docbridge-rust-scanner",
178034
+ go: "docbridge-go-scanner"
178030
178035
  };
178031
178036
  function scannerPlatformKey() {
178032
178037
  return `${process.platform}-${process.arch}`;
@@ -178075,6 +178080,12 @@ function scannerExecutableCandidates(language, platformKey, platformSupported, o
178075
178080
  ...platformSupported ? [join5(distRoot, "bin", platformKey, executable)] : []
178076
178081
  ];
178077
178082
  }
178083
+ if (language === "go") {
178084
+ return [
178085
+ join5(sourceRoot, "packages/go-scanner/bin", executable),
178086
+ ...platformSupported ? [join5(distRoot, "bin", platformKey, executable)] : []
178087
+ ];
178088
+ }
178078
178089
  return [
178079
178090
  join5(sourceRoot, "packages/dart-scanner/bin", executable),
178080
178091
  ...platformSupported ? [join5(distRoot, "bin", platformKey, executable)] : []
@@ -178188,7 +178199,7 @@ var common_output_schema_default = {
178188
178199
  target: { type: "string" },
178189
178200
  language: {
178190
178201
  type: "string",
178191
- enum: ["typescript", "swift", "dart", "rust"]
178202
+ enum: ["typescript", "swift", "dart", "rust", "go"]
178192
178203
  },
178193
178204
  source: { type: "string" },
178194
178205
  message: { type: "string" },
@@ -178208,7 +178219,7 @@ var scanner_worker_schema_default = {
178208
178219
  $defs: {
178209
178220
  language: {
178210
178221
  type: "string",
178211
- enum: ["typescript", "swift", "dart", "rust"]
178222
+ enum: ["typescript", "swift", "dart", "rust", "go"]
178212
178223
  },
178213
178224
  codeSymbol: {
178214
178225
  type: "object",
@@ -178560,7 +178571,8 @@ var builtInAdapters = {
178560
178571
  typescript: typeScriptAdapter,
178561
178572
  swift: createScannerWorkerAdapter("swift", () => resolveScannerWorkerCommand("swift")),
178562
178573
  dart: createScannerWorkerAdapter("dart", () => resolveScannerWorkerCommand("dart")),
178563
- rust: createScannerWorkerAdapter("rust", () => resolveScannerWorkerCommand("rust"))
178574
+ rust: createScannerWorkerAdapter("rust", () => resolveScannerWorkerCommand("rust")),
178575
+ go: createScannerWorkerAdapter("go", () => resolveScannerWorkerCommand("go"))
178564
178576
  };
178565
178577
  function emptyScan(language, filePath) {
178566
178578
  return {
@@ -180643,11 +180655,13 @@ var TYPESCRIPT_PATTERNS = [
180643
180655
  var SWIFT_PATTERNS = ["Sources/**/*.swift", "*/Sources/**/*.swift"];
180644
180656
  var DART_PATTERNS = ["lib/**/*.dart"];
180645
180657
  var RUST_PATTERNS = ["src/**/*.rs", "*/src/**/*.rs"];
180658
+ var GO_PATTERNS = ["*.go", "cmd/**/*.go", "internal/**/*.go", "pkg/**/*.go"];
180646
180659
  var LANGUAGE_PATTERNS = {
180647
180660
  typescript: TYPESCRIPT_PATTERNS,
180648
180661
  swift: SWIFT_PATTERNS,
180649
180662
  dart: DART_PATTERNS,
180650
- rust: RUST_PATTERNS
180663
+ rust: RUST_PATTERNS,
180664
+ go: GO_PATTERNS
180651
180665
  };
180652
180666
  function discoverRepository(projectRoot) {
180653
180667
  return {
@@ -180854,6 +180868,11 @@ function isExcludedCodeFile(filePath, language) {
180854
180868
  return true;
180855
180869
  }
180856
180870
  }
180871
+ if (language === "go") {
180872
+ if (lower.endsWith("_test.go") || segments.includes("vendor") || segments.includes("testdata")) {
180873
+ return true;
180874
+ }
180875
+ }
180857
180876
  if (segments.some((segment) => ["generated", "gen", ".dart_tool", "build"].includes(segment.toLowerCase()))) {
180858
180877
  return true;
180859
180878
  }
@@ -181609,6 +181628,9 @@ function fenceLanguage(language) {
181609
181628
  if (language === "rust") {
181610
181629
  return "rust";
181611
181630
  }
181631
+ if (language === "go") {
181632
+ return "go";
181633
+ }
181612
181634
  return "ts";
181613
181635
  }
181614
181636
  function codeFence(content) {
@@ -33,15 +33,20 @@ Declare documentation patterns and at least one supported code language:
33
33
  }
34
34
  ```
35
35
 
36
- Supported language keys are `typescript`, `swift`, `dart`, and `rust`. A project can
37
- enable more than one language, each with its own patterns.
36
+ Supported language keys are `typescript`, `swift`, `dart`, `rust`, and `go`. A
37
+ project can enable more than one language, each with its own patterns.
38
38
 
39
39
  Each language accepts an optional `visibility` array. Omitting it uses the
40
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
41
+ and `open`, Dart `public` only, Rust unrestricted `pub`, Go `exported`. A
42
+ declaration excluded by visibility is not an endpoint; an `@doc` on one is
43
43
  `unsupported_declaration`. See `docbridge docs show linking` for the
44
- per-language rules, including Dart's leading-underscore privacy.
44
+ per-language rules, including Dart's leading-underscore privacy and Go's
45
+ exported-name rule for methods.
46
+
47
+ The configuration has no `exclude` list and no glob negation. Narrow the
48
+ positive patterns instead; for Go, `cmd/**/*.go` and `internal/**/*.go` scan
49
+ fewer files than `**/*.go`, but `_test.go` files under them are still scanned.
45
50
 
46
51
  <!-- @code src/shared/glob.ts#collectFiles -->
47
52
 
@@ -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, Swift, Dart, Rust, or Go project.
3
3
  ---
4
4
 
5
5
  # Getting Started
@@ -72,6 +72,13 @@ void login(String email, String password) {}
72
72
  pub fn login(email: &str, password: &str) {}
73
73
  ```
74
74
 
75
+ ```go
76
+ // Login starts the login flow.
77
+ //
78
+ // @doc docs/auth.md#login-flow
79
+ func Login(email, password string) error { return nil }
80
+ ```
81
+
75
82
  Paths are relative to the configured root. An annotation on an unsupported or
76
83
  visibility-excluded declaration produces `unsupported_declaration`; the same
77
84
  declaration without an annotation is ignored.
@@ -114,6 +121,25 @@ to include non-`pub` items. Trait definitions and implementations, macros,
114
121
  constants, statics, unions, and extern blocks are not endpoints. IDs use `::`
115
122
  qualification, such as `TypingEngine::advance`.
116
123
 
124
+ ### Go declarations
125
+
126
+ Supported forms are package-level functions, types (including aliases),
127
+ constants, and variables, plus receiver methods and interface methods. The
128
+ annotation goes in the declaration's doc comment, as `//` lines or one
129
+ `/* */` block. Visibility defaults to `exported`; configure `unexported` to
130
+ include unexported names. A method counts as exported only when both its name
131
+ and its receiver or interface type name are exported. IDs use `.`
132
+ qualification without type parameters, such as `AuthService.Login` and
133
+ `List.Push` for `func (l *List[T]) Push`.
134
+
135
+ Inside a `const (`, `var (`, or `type (` group, annotate the individual spec;
136
+ an `@doc` in the comment above the group keyword, or above a spec that
137
+ declares several names (`var a, b int`), is `unsupported_declaration` because
138
+ it cannot name one endpoint. Struct fields, embedded fields, the `package`
139
+ clause, imports, `init`, and `_` are not endpoints. The scanner is syntactic:
140
+ `_test.go` files and `//go:build`-constrained files are scanned whenever the
141
+ patterns match them.
142
+
117
143
  <!-- @code src/scan/markdown/markdown.ts#scanMarkdown -->
118
144
 
119
145
  ## Documentation to code
@@ -30,7 +30,7 @@ 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
@@ -41,7 +41,7 @@ converting it into a broken link. Check that the source parses with the
41
41
  project's own toolchain, then reproduce with the smallest configured file
42
42
  set.
43
43
 
44
- `code_parse_error` means a TypeScript, Swift, Dart, or Rust source file has a
44
+ `code_parse_error` means a TypeScript, Swift, Dart, Rust, or Go source file has a
45
45
  syntax error. The diagnostic points at the first error the language's parser
46
46
  found and includes the parser's message. DocBridge extracts no links or symbols
47
47
  from that file, so fix the syntax before judging link diagnostics that involve
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docbridge",
3
- "version": "0.10.1",
3
+ "version": "0.11.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,7 @@
44
44
  "target": { "type": "string" },
45
45
  "language": {
46
46
  "type": "string",
47
- "enum": ["typescript", "swift", "dart", "rust"]
47
+ "enum": ["typescript", "swift", "dart", "rust", "go"]
48
48
  },
49
49
  "source": { "type": "string" },
50
50
  "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"],
39
39
  "description": "Code language for code context blocks."
40
40
  },
41
41
  "startLine": {
@@ -21,7 +21,8 @@
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" }
25
26
  }
26
27
  },
27
28
  "docs": {
@@ -123,6 +124,28 @@
123
124
  }
124
125
  }
125
126
  }
127
+ },
128
+ "goEntry": {
129
+ "type": "object",
130
+ "additionalProperties": false,
131
+ "required": ["patterns"],
132
+ "properties": {
133
+ "patterns": {
134
+ "type": "array",
135
+ "minItems": 1,
136
+ "items": {
137
+ "type": "string",
138
+ "pattern": "\\.go$"
139
+ }
140
+ },
141
+ "visibility": {
142
+ "type": "array",
143
+ "items": {
144
+ "type": "string",
145
+ "enum": ["exported", "unexported"]
146
+ }
147
+ }
148
+ }
126
149
  }
127
150
  }
128
151
  }
@@ -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"],
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"]
11
11
  },
12
12
  "codeSymbol": {
13
13
  "type": "object",