docbridge 0.10.0 → 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.
@@ -34,8 +34,8 @@ docbridge init-with-agent --agent-target codex
34
34
  Use `claude` or `both` for the other supported targets. The command installs
35
35
  the skill and prints the next command or prompt; it does not launch an agent.
36
36
 
37
- <!-- @code src/core/context.ts#context -->
38
- <!-- @code src/core/related.ts#related -->
37
+ <!-- @code src/query/context.ts#context -->
38
+ <!-- @code src/query/related.ts#related -->
39
39
 
40
40
  ## Editing workflow
41
41
 
@@ -13,7 +13,7 @@ Use the narrowest command for the question you need to answer.
13
13
  The first argument selects a command. Global `--help` and `--version` are
14
14
  handled before project scanning, while each command validates its own options.
15
15
 
16
- <!-- @code src/core/resolver.ts#check -->
16
+ <!-- @code src/query/check.ts#check -->
17
17
 
18
18
  ### `check`: validate the project
19
19
 
@@ -22,7 +22,7 @@ annotations, targets, reciprocal links, and the optional link manifest. Add
22
22
  `--audit` to include warnings for undocumented code declarations and unlinked
23
23
  Markdown sections. Add `--json` for machine-readable diagnostics.
24
24
 
25
- <!-- @code src/core/related.ts#related -->
25
+ <!-- @code src/query/related.ts#related -->
26
26
 
27
27
  ### `related`: find counterpart files
28
28
 
@@ -36,7 +36,7 @@ git diff --name-only | docbridge related --stdin
36
36
  set. It identifies review obligations; it does not decide whether the
37
37
  counterpart actually needs an edit.
38
38
 
39
- <!-- @code src/core/context.ts#context -->
39
+ <!-- @code src/query/context.ts#context -->
40
40
 
41
41
  ### `context`: read counterpart content
42
42
 
@@ -49,7 +49,7 @@ docbridge context src/auth.ts
49
49
  The default Markdown output is suitable for an agent prompt. `--json` returns
50
50
  structured contexts, diagnostics, and a summary.
51
51
 
52
- <!-- @code src/core/graph-output.ts#graph -->
52
+ <!-- @code src/query/graph-output.ts#graph -->
53
53
 
54
54
  ### `graph`: inspect link structure
55
55
 
@@ -8,7 +8,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
9
  interpreted relative to that root.
10
10
 
11
- <!-- @code src/core/config.ts#loadConfig -->
11
+ <!-- @code src/config/config.ts#loadConfig -->
12
12
 
13
13
  ## Loading configuration
14
14
 
@@ -33,17 +33,22 @@ 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.
45
46
 
46
- <!-- @code src/core/glob.ts#collectFiles -->
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.
50
+
51
+ <!-- @code src/shared/glob.ts#collectFiles -->
47
52
 
48
53
  ## Excluded files
49
54
 
@@ -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
@@ -32,7 +32,7 @@ Use `docbridge check --audit` to find unlinked sections and undocumented public
32
32
  symbols. Audit diagnostics are candidates for judgment, not instructions to
33
33
  link every item.
34
34
 
35
- <!-- @code src/core/links.ts#parseLinkTarget -->
35
+ <!-- @code src/model/link-target.ts#parseLinkTarget -->
36
36
 
37
37
  ## Target grammar
38
38
 
@@ -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,7 +121,26 @@ 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
 
117
- <!-- @code src/core/markdown.ts#scanMarkdown -->
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
+
143
+ <!-- @code src/scan/markdown/markdown.ts#scanMarkdown -->
118
144
 
119
145
  ## Documentation to code
120
146
 
@@ -144,7 +170,7 @@ numeric suffixes.
144
170
  Each direction is validated independently, so a resolving target can still
145
171
  report a missing backlink. Run `docbridge check` after every edit.
146
172
 
147
- <!-- @code src/core/link-manifest.ts#loadLinkManifest -->
173
+ <!-- @code src/config/link-manifest.ts#loadLinkManifest -->
148
174
 
149
175
  ## Declare links in a manifest
150
176
 
@@ -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,9 +41,11 @@ 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
45
- syntax error. DocBridge extracts no links or symbols from that file, so fix the
46
- syntax before judging link diagnostics that involve it. Unlike
44
+ `code_parse_error` means a TypeScript, Swift, Dart, Rust, or Go 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
47
+ from that file, so fix the syntax before judging link diagnostics that involve
48
+ it. Unlike
47
49
  `code_scanner_failed`, the worker ran correctly; the source itself did not
48
50
  parse.
49
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docbridge",
3
- "version": "0.10.0",
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",