docbridge 0.6.0 → 0.7.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,127 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.0] - 2026-08-16
11
+
12
+ ### Added
13
+
14
+ - Rust is a first-party code language. Configure `include.code.rust`, place
15
+ `@doc` in `///` / `//!` / `/** */` comments on modules, structs, enums, free
16
+ functions, and inherent `impl` methods, and check links with the bundled
17
+ `docbridge-rust-scanner` worker (same platforms as Swift/Dart). Default
18
+ visibility is `pub` only; set `visibility` to include `private` for
19
+ non-`pub` items. Canonical IDs use Rust path style (`Type::method`).
20
+ - `docbridge docs list [--json]` and `docbridge docs show <name>` provide six
21
+ task-oriented, version-matched guides from the installed npm package, with
22
+ packed-package smoke coverage under Node.js and Bun.
23
+ - CLI invocation errors now list valid commands, suggest close command names,
24
+ and include runnable command-specific recovery guidance. Missing check
25
+ configuration also points to `docbridge init` and `docbridge init-with-agent`.
26
+ - TypeScript type members can be link endpoints, closing the last functional
27
+ asymmetry with Swift and Dart. `@doc` on a class method, property, getter,
28
+ setter, constructor, or static member, on an interface member, or on a member
29
+ of a type alias written directly as an object type literal resolves to a
30
+ type-qualified endpoint such as `AuthService.login`. Canonical IDs carry no
31
+ parameter signatures: overload groups and getter/setter pairs each describe
32
+ one member and collapse to one endpoint, and a collision — including a static
33
+ and an instance member of the same name — reports `duplicate_code_symbol`.
34
+ Only identifier-named members qualify, because a link target is
35
+ `file#fragment` with one `#` and no whitespace.
36
+ - `include.code.typescript.visibility` accepts `public`, `protected`, and
37
+ `private`, defaulting to `public` and `protected`. It scopes type members
38
+ only; top-level declarations remain scoped by `export`.
39
+
40
+ ### Changed
41
+
42
+ - Scanner worker request and response payloads now have a published JSON Schema,
43
+ and malformed nested worker output fails explicitly instead of degrading into
44
+ incomplete scan data. Graph and context output schemas share their diagnostic
45
+ definitions and are checked against real CLI output. The configuration schema
46
+ now matches the CLI's per-language suffix and visibility rules.
47
+ - `docbridge context` and `docbridge graph --include-content` strip the common
48
+ leading indentation from an extracted declaration, so a type member reads at
49
+ its own level. Output for top-level declarations is unchanged.
50
+ - A `@doc` on a TypeScript type member was previously collected by nothing and
51
+ silently ignored. It is now a real annotation, so an existing one can surface
52
+ link diagnostics — `invalid_link_target`, `doc_file_not_found`,
53
+ `doc_anchor_not_found`, `doc_backlink_not_found` — that were always latent,
54
+ and an annotation on a `private` member becomes `unsupported_declaration`.
55
+ `check --audit` output is unchanged: members never count as
56
+ `undocumented_symbol`.
57
+ - `docbridge check --audit` reports `unlinked_doc_section`, a warning for
58
+ in-scope documentation sections that carry no `@code` annotation. It is the
59
+ documentation-side counterpart to `undocumented_symbol`, so the audit now
60
+ covers both directions of the link graph. Reporting is rolled up over the
61
+ heading tree: only the topmost heading of a fully unannotated subtree is
62
+ reported, and a heading is treated as annotated whenever a `@code` comment is
63
+ attached to it, even if that annotation fails to parse or resolve. Empty
64
+ headings create no anchor and are never reported, but they still close the
65
+ section before them, so a deeper heading following one is a separate region
66
+ rather than a suppressed descendant. Runs
67
+ without `--audit` are unaffected, and the diagnostic is a warning, so exit
68
+ codes do not change.
69
+
70
+ ### Fixed
71
+
72
+ - Swift and Dart scanners now report malformed and duplicate `@doc` targets as
73
+ `invalid_link_target` and `duplicate_link`, matching TypeScript instead of
74
+ silently accepting or discarding the annotations.
75
+ - `docbridge graph --include-content` no longer truncates a signature at an
76
+ object type. It cut the rendered text at the first `{`, which for
77
+ `login(options: { verbose: boolean })` produced `login(options: {}`. A
78
+ `signatureRange` already ends where the implementation body begins in every
79
+ language, so no body has to be cut out of it.
80
+ - The VS Code extension manifest is version-aligned with the npm package again
81
+ (`0.4.1` had drifted from `0.6.1`), so a checkout of `main` is a valid input
82
+ to `just package-vsix`. Release Prepare now bumps both manifests through
83
+ `scripts/set-release-version.ts` and stages both in the release commit, so a
84
+ CLI release can no longer leave the extension version behind.
85
+ - `just package-vsix` bundles the server the VSIX ships with `--target node`,
86
+ matching the npm build. The Bun-targeted bundle it built before still carried
87
+ a `#!/usr/bin/env node` shebang and crashed with `__require is not a function`
88
+ when the packaging flow's own `verify-dist` step executed it.
89
+
90
+ ### Removed
91
+
92
+ - The agent-hook integration is gone from the product surface: the copyable
93
+ scripts under `examples/hooks/` and the hook recipes in
94
+ `docs/integrations/claude-code.md` and `docs/integrations/codex.md` no longer
95
+ ship. Wiring DocBridge into an agent's `PostToolUse`/`Stop` hooks covered only
96
+ the agents that read those configuration files; the documented guardrail is
97
+ now a Git `pre-commit` hook, which applies to every contributor and every
98
+ tool. Both integration documents survive as skill-installation guides,
99
+ `docbridge context` and `docbridge related --gate` are unchanged, and
100
+ `docbridge docs show agent-integration` describes the Git-hook shape instead.
101
+ Copies already installed in adopters' repositories keep working.
102
+
103
+ ## [0.6.1] - 2026-07-27
104
+
105
+ ### Changed
106
+
107
+ - The related-gate CI recipe in `docs/integrations/ci.md` now derives the PR
108
+ changed-file list from the checkout (`git diff BASE...HEAD` with
109
+ `fetch-depth: 0`) and falls back to a retried GitHub API call. Outcomes are
110
+ reported as `clean`, `violation`, or `infra-error`, and the sticky comment
111
+ updates on every outcome (including infrastructure failure). Adopters who
112
+ copied the previous recipe must re-copy it and set `fetch-depth: 0` on the
113
+ checkout step; a shallow checkout breaks the new primary path.
114
+ - Shipped Swift and Dart scanner executables are now named
115
+ `docbridge-swift-scanner` and `docbridge_dart_scanner`. Paths under
116
+ `dist/bin/<platform>/speclink-*` no longer exist; delete `chmod +x`
117
+ workarounds that hard-coded those names rather than updating the paths.
118
+
119
+ ### Fixed
120
+
121
+ - Bundled Swift and Dart scanner binaries no longer have to be executable at
122
+ install time. Installers do not reliably preserve the executable bit on files
123
+ under `dist/bin/`, which made `docbridge check` fail on every Swift or Dart
124
+ project; DocBridge now restores the bit on its own bundled scanners when the
125
+ current process cannot execute them. Consumers can remove `chmod +x`
126
+ workarounds from their build recipes. When the bit cannot be restored, or when
127
+ the binary is executable but the filesystem refuses to execute it as a
128
+ `noexec` mount does, `code_scanner_unavailable` now names the cause and the
129
+ remedy instead of surfacing a bare spawn error.
130
+
10
131
  ## [0.6.0] - 2026-07-13
11
132
 
12
133
  ### Added
@@ -194,7 +315,9 @@ Initial release of the SpecLink CLI.
194
315
  - `speclink check` command with `--root`, `--json`, and `--audit` options.
195
316
  - `speclink --version` (alias `-v`) and `speclink --help` (alias `-h`).
196
317
 
197
- [Unreleased]: https://github.com/salan70/docbridge/compare/v0.6.0...HEAD
318
+ [Unreleased]: https://github.com/salan70/docbridge/compare/v0.7.0...HEAD
319
+ [0.7.0]: https://github.com/salan70/docbridge/releases/tag/v0.7.0
320
+ [0.6.1]: https://github.com/salan70/docbridge/releases/tag/v0.6.1
198
321
  [0.6.0]: https://github.com/salan70/docbridge/releases/tag/v0.6.0
199
322
  [0.5.2]: https://github.com/salan70/docbridge/releases/tag/v0.5.2
200
323
  [0.5.1]: https://github.com/salan70/docbridge/releases/tag/v0.5.1
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Bring Markdown into the LSP world.
8
8
 
9
- DocBridge creates bidirectional links between TypeScript, Swift, or Dart code
9
+ DocBridge creates bidirectional links between TypeScript, Swift, Dart, or Rust code
10
10
  and Markdown documentation, enabling LSP-like experiences such as Hover,
11
11
  Definition, References, and Diagnostics across implementation and specification
12
12
  files.
@@ -22,13 +22,13 @@ npx docbridge check
22
22
  bunx docbridge check
23
23
  ```
24
24
 
25
- The current release is
26
- [v0.5.0](https://github.com/salan70/docbridge/releases/tag/v0.5.0), published
27
- as `docbridge@0.5.0` on npm.
25
+ See the npm badge above or
26
+ [Releases](https://github.com/salan70/docbridge/releases) for the current
27
+ version.
28
28
 
29
- The package includes prebuilt Swift and Dart scanner
29
+ The package includes prebuilt Swift, Dart, and Rust scanner
30
30
  binaries for `darwin-arm64` and `linux-x64`. TypeScript and Markdown checks run
31
- without scanner binaries. Configured Swift or Dart projects on unsupported
31
+ without scanner binaries. Configured Swift, Dart, or Rust projects on unsupported
32
32
  platforms report `code_scanner_unavailable` and name the supported platform
33
33
  keys.
34
34
 
@@ -84,6 +84,7 @@ Add the backlink in the Markdown file:
84
84
 
85
85
  ```md
86
86
  <!-- @code src/auth/login.ts#login -->
87
+
87
88
  ## Login Spec
88
89
 
89
90
  Login flow specification.
@@ -97,6 +98,16 @@ bunx docbridge check
97
98
 
98
99
  ## Usage
99
100
 
101
+ Discover a command:
102
+
103
+ ```sh
104
+ bunx docbridge --help
105
+ bunx docbridge context --help
106
+ ```
107
+
108
+ Every command accepts `--help` (alias `-h`) and prints its usage, when to use
109
+ it, and its options on stdout.
110
+
100
111
  Check links:
101
112
 
102
113
  ```sh
@@ -123,7 +134,8 @@ bunx docbridge check --audit
123
134
 
124
135
  Audit diagnostics include:
125
136
 
126
- - `undocumented_symbol`
137
+ - `undocumented_symbol` — in-scope code endpoints with no `@doc`
138
+ - `unlinked_doc_section` — in-scope documentation sections with no `@code`
127
139
 
128
140
  List the linked counterparts of changed files:
129
141
 
@@ -192,7 +204,7 @@ Code <-> Documentation
192
204
  ```
193
205
 
194
206
  DocBridge links supported code declarations to Markdown sections. TypeScript is
195
- scanned in-process; Swift and Dart are scanned through bundled first-party
207
+ scanned in-process; Swift, Dart, and Rust are scanned through bundled first-party
196
208
  worker packages.
197
209
 
198
210
  ## Supported Inputs
@@ -204,11 +216,15 @@ Supported code declarations:
204
216
  - TypeScript top-level exported declarations: `function`, `class`,
205
217
  `abstract class`, `interface`, `type`, `const`, `enum`, and supported
206
218
  `declare` / named default forms
219
+ - TypeScript type members: class methods, properties, accessors, constructors,
220
+ and static members, plus interface and object-type-alias signatures
207
221
  - Swift public/open declarations and configured internal declarations:
208
222
  top-level and member types, functions, variables, constants, initializers,
209
223
  and extension members
210
224
  - Dart public declarations: top-level functions/variables, classes, enums,
211
225
  mixins, constructors, fields, accessors, methods, and extension members
226
+ - Rust `pub` declarations (and configured non-`pub` with `visibility`):
227
+ modules, structs, enums, free functions, and inherent `impl` methods
212
228
 
213
229
  Supported Markdown elements:
214
230
 
@@ -216,8 +232,29 @@ Supported Markdown elements:
216
232
  - HTML comments
217
233
  - `@code` annotations attached to the next heading
218
234
 
219
- Swift and Dart use the same `@doc` and `@code` model. Their code fragments are
220
- the scanner-produced canonical IDs, so members are type-qualified:
235
+ All four languages use the same `@doc` and `@code` model. Code fragments are
236
+ the scanner-produced canonical IDs, so members are type-qualified.
237
+
238
+ TypeScript member IDs carry no parameter signature; overload signatures and a
239
+ getter/setter pair each collapse to one endpoint, and the constructor is
240
+ `<Type>.constructor`. By default `public` and `protected` members are scanned;
241
+ `private` members require `include.code.typescript.visibility`. Members are
242
+ linkable but are never reported by `check --audit`.
243
+
244
+ ```ts
245
+ export class AuthService {
246
+ /** @doc docs/auth.md#login-spec */
247
+ login(email: string, password: string): void {}
248
+ }
249
+ ```
250
+
251
+ ```md
252
+ <!-- @code src/auth/service.ts#AuthService.login -->
253
+
254
+ ## Login Spec
255
+ ```
256
+
257
+ Swift, Dart, and Rust canonical IDs follow their own conventions:
221
258
 
222
259
  ```swift
223
260
  /// @doc docs/auth.md#login-spec
@@ -228,6 +265,7 @@ public struct AuthService {
228
265
 
229
266
  ```md
230
267
  <!-- @code Sources/AuthService.swift#AuthService.login(email:password:) -->
268
+
231
269
  ## Login Spec
232
270
  ```
233
271
 
@@ -266,27 +304,27 @@ shape is intentionally invalid; migrate it to a `typescript` entry:
266
304
  }
267
305
  ```
268
306
 
269
- Swift and Dart projects must build their scanner workers in source checkouts
270
- before checking those languages. Run `just build-swift-scanner` for Swift and
271
- `just build-dart-scanner` for Dart, or use the native test recipes below.
307
+ Swift, Dart, and Rust projects must build their scanner workers in source checkouts
308
+ before checking those languages. Run `just build-swift-scanner` for Swift,
309
+ `just build-dart-scanner` for Dart, and `just build-rust-scanner` for Rust, or
310
+ use the native test recipes below.
272
311
 
273
312
  ## AI agent integration
274
313
 
275
314
  DocBridge's link graph is built to be consumed by AI coding agents:
276
315
 
277
316
  - [docs/integrations](docs/integrations) — recipes for Claude Code, Codex,
278
- and CI: on-edit counterpart awareness with `docbridge context`, gate triage
279
- with `docbridge related --gate`, and PR reporting.
280
- - [examples/hooks](examples/hooks) — copyable agent hook scripts implementing
281
- those recipes.
317
+ and CI: gate triage with `docbridge related --gate`, counterpart content with
318
+ `docbridge context`, and PR reporting.
282
319
  - [templates/skills](templates/skills) — distributable agent skills installed by
283
320
  `docbridge init`; `docbridge init-with-agent` installs `docbridge-adopt`
284
- first, then `docbridge-adopt` installs the companion skills:
285
- `docbridge-annotate`, `docbridge-sync`, `docbridge-adopt`, `docbridge-link`,
286
- and `docbridge-review`.
321
+ alone, then `docbridge-adopt` installs the companion skills:
322
+ `docbridge-annotate`, `docbridge-link`, `docbridge-review`, and
323
+ `docbridge-sync`.
287
324
 
288
- This repository dogfoods the hooks and skills in its own guardrails under
289
- `.claude/`, `.codex/`, and `.agents/`.
325
+ This repository dogfoods the skills under `.claude/` and `.agents/`, and keeps
326
+ its guardrail in the Git `pre-commit` hook under `.githooks/` rather than in
327
+ any agent's configuration.
290
328
 
291
329
  ## Editor support
292
330
 
@@ -337,6 +375,8 @@ Errors:
337
375
  - `duplicate_doc_anchor`
338
376
  - `duplicate_code_symbol`
339
377
  - `code_parse_error`
378
+ - `code_scanner_unavailable`
379
+ - `code_scanner_failed`
340
380
  - `file_read_error`
341
381
 
342
382
  Warnings:
@@ -345,120 +385,21 @@ Warnings:
345
385
  - `dangling_code_annotation`
346
386
  - `unsupported_declaration`
347
387
  - `undocumented_symbol` when `--audit` is enabled
388
+ - `unlinked_doc_section` when `--audit` is enabled
348
389
 
349
390
  Exit code policy:
350
391
 
351
392
  - `1` when any error exists
352
393
  - `0` when there are only warnings or no diagnostics
353
394
 
354
- ## Development
355
-
356
- ### Prerequisites
357
-
358
- Recommended:
359
-
360
- - Nix
361
- - direnv
362
-
363
- The Nix development shell provides the tools used by this repository:
364
-
365
- - Bun
366
- - just
367
- - Git
368
- - Dart SDK
369
-
370
- If you do not use Nix, install Bun and just locally before running the project
371
- commands. Swift scanner development also requires a Swift 6 toolchain on
372
- `PATH`; CI installs Swift separately from Nix.
373
-
374
- ### Setup
375
-
376
- Enable the development environment with direnv:
377
-
378
- ```sh
379
- direnv allow
380
- ```
381
-
382
- Or enter the Nix development shell manually:
383
-
384
- ```sh
385
- nix develop
386
- ```
387
-
388
- Install dependencies:
389
-
390
- ```sh
391
- bun install --frozen-lockfile
392
- ```
393
-
394
- Install repository Git hooks:
395
-
396
- ```sh
397
- just install-git-hooks
398
- ```
399
-
400
- If `just` is not on `PATH` yet, run:
401
-
402
- ```sh
403
- nix develop -c just install-git-hooks
404
- ```
405
-
406
- The pre-commit hook runs `just check` and `just test`.
407
-
408
- ### Common Tasks
409
-
410
- Run common tasks with `just`:
411
-
412
- ```sh
413
- just --list
414
- just check
415
- just check-example
416
- just check-swift-example
417
- just check-dart-example
418
- just check-fixture <code>
419
- just audit
420
- just related-gate
421
- just test
422
- just test-swift-scanner
423
- just test-dart-scanner
424
- just build
425
- just verify-dist
426
- ```
427
-
428
- `just check`, `just test`, and `just build` are the default local and CI gates.
429
- `just test` includes TypeScript, Swift, and Dart end-to-end integration tests;
430
- the Swift and Dart scanner binaries must be built before those integration
431
- tests can spawn them. Scanner-native tests are mandatory in CI and are useful
432
- locally when changing worker code. `just verify-dist` builds confidence in the
433
- npm entry point by checking the Bun shebang, executable bit, `--version`,
434
- `--help`, and a TypeScript example check from `dist/index.js`.
435
-
436
- ### Project Constraints
437
-
438
- Runtime:
439
-
440
- - Bun
441
-
442
- Language:
443
-
444
- - TypeScript
445
- - Swift scanner worker package
446
- - Dart scanner worker package
447
-
448
- Task runner:
449
-
450
- - just
451
-
452
- Environment loader:
453
-
454
- - direnv
395
+ ## Contributing
455
396
 
456
- Core dependencies should stay minimal. The CLI should primarily rely on Bun and
457
- the TypeScript Compiler API; Swift and Dart parser dependencies stay isolated
458
- inside their worker packages.
397
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the pinned development environment,
398
+ repository setup, testing matrix, commit convention, and pull request workflow.
459
399
 
460
400
  ## Documentation
461
401
 
402
+ - Contributor guide: [CONTRIBUTING.md](CONTRIBUTING.md)
462
403
  - Japanese documentation: [docs/ja/README.md](docs/ja/README.md)
463
404
  - Specifications: [docs/specs](docs/specs)
464
405
  - v0.1 decisions: [docs/decisions/v0.1.md](docs/decisions/v0.1.md)
@@ -466,11 +407,12 @@ inside their worker packages.
466
407
  - v0.3 decisions: [docs/decisions/v0.3.md](docs/decisions/v0.3.md)
467
408
  - AI agent integration recipes: [docs/integrations](docs/integrations)
468
409
  - Commit message convention: [docs/contributing/commits.md](docs/contributing/commits.md)
410
+ - Pull request convention: [docs/contributing/pull-requests.md](docs/contributing/pull-requests.md)
469
411
  - Testing convention: [docs/contributing/testing.md](docs/contributing/testing.md)
470
412
 
471
413
  ## Roadmap
472
414
 
473
- Completed v0.1–v0.5 capabilities are documented above and in
415
+ Completed v0.1–v0.6 capabilities are documented above and in
474
416
  [CHANGELOG.md](CHANGELOG.md).
475
417
 
476
418
  Remaining editor delivery work:
@@ -1,2 +1,3 @@
1
- 3906f1b665d3af642c6c46f7ac0c066dee93f8724a5dd139955becc7dac62d4f speclink-swift-scanner
2
- 33711635bbf663db5497ae88ee0f9ae181cdefdff67fce021986c106d4327f67 speclink_dart_scanner
1
+ bc9e7548f993e48d280c3a487be4cc90a3e6549491c6f93f0e518ccc4239d991 docbridge-swift-scanner
2
+ ceb237b7e5b2047d091f961c0a43ba436b8c624c741cc7f864e5783d9248a4eb docbridge_dart_scanner
3
+ a1b129d980c981a2d24f0c9682e614a9695d4e9f9b8174d61b0dacb3fc9e3c79 docbridge-rust-scanner
@@ -1,2 +1,3 @@
1
- 72d604680e80c5eb6c30d778dcd9d6b70e45b7a9da907723b5fd36b6a77ef882 speclink-swift-scanner
2
- cfc22c423afaa1e42bef7c0c6b7de42fa54a3e11ca5baad518cd19e0c9c1258d speclink_dart_scanner
1
+ 114f780cebfb8834f200ef60f3a828ca7dc4668b23f6e646971e3e56c377b37a docbridge-swift-scanner
2
+ 095c4c172da615be155bee15dcce7b99faaf2a8bb26f3cad3e0b17881495ddf2 docbridge_dart_scanner
3
+ d89a1146ed10dcb01151ef5351a746862c3955286431c47f3cf91cf6639866ba docbridge-rust-scanner