docbridge 0.4.0 → 0.4.1

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,11 +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.4.0] - 2026-06-18
10
+ ## [0.4.1] - 2026-06-21
11
11
 
12
12
  ### Added
13
13
 
14
- - npm distribution support for the Bun-only `speclink` package, including
14
+ - `docbridge init` for CLI-driven first-time setup: repository scope discovery,
15
+ safe `docbridge.config.json` creation, and DocBridge agent skill installation.
16
+ - `docbridge init-with-agent` for agent-guided adoption: installs
17
+ `docbridge-adopt` and prints one-shot setup commands without launching an
18
+ agent process.
19
+ - `docbridge-adopt` now installs the companion DocBridge skills after adoption
20
+ scope is confirmed.
21
+
22
+ ## [0.4.0] - 2026-06-20
23
+
24
+ ### Added
25
+
26
+ - npm distribution support for the Bun-only `docbridge` package, including
15
27
  `dist/index.js` as the package binary, a runtime package allowlist, dist
16
28
  verification, packed-package smoke testing, and release workflow publishing.
17
29
  - Platform-staged Swift and Dart scanner binary layout under
@@ -28,21 +40,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
28
40
  - Worker-backed scanner protocol foundation for Swift and Dart adapters,
29
41
  including stdin/stdout JSON invocation and scanner availability/failure
30
42
  diagnostics.
31
- - `speclink graph`: prints the resolved link graph as human-readable output or
43
+ - `docbridge graph`: prints the resolved link graph as human-readable output or
32
44
  as JSON following `schemas/graph-output.schema.json`, including resolvable
33
45
  one-way links, pair completeness, optional lightweight node content, and
34
46
  diagnostics that do not prevent graph construction.
35
- - Distributable adoption skills under `templates/skills/`: `speclink-adopt`
36
- for existing-project setup, `speclink-link` for docs-first annotation
37
- candidate confirmation, and `speclink-review` for whole-graph semantic
38
- review using `speclink graph --json --include-content`.
47
+ - Distributable adoption skills under `templates/skills/`: `docbridge-adopt`
48
+ for existing-project setup, `docbridge-link` for docs-first annotation
49
+ candidate confirmation, and `docbridge-review` for whole-graph semantic
50
+ review using `docbridge graph --json --include-content`.
39
51
 
40
52
  ### Changed
41
53
 
42
- - `speclink context` and `speclink graph --json` now carry code language
54
+ - The project, package, command, configuration file, templates, and repository
55
+ URLs were renamed from SpecLink/`speclink` to DocBridge/`docbridge`.
56
+ - `docbridge context` and `docbridge graph --json` now carry code language
43
57
  metadata for code blocks/nodes so Swift endpoints render and serialize as
44
58
  Swift.
45
- - SpecLink's distributable skills are now dogfooded from `.agents/skills/` and
59
+ - DocBridge's distributable skills are now dogfooded from `.agents/skills/` and
46
60
  `.claude/skills/` as symlinks to the canonical `templates/skills/` entries.
47
61
  - TypeScript scanner endpoints now include `signatureRange` in addition to the
48
62
  existing full `declarationRange`, allowing graph consumers to read the
@@ -135,7 +149,8 @@ Initial release of the SpecLink CLI.
135
149
  - `speclink check` command with `--root`, `--json`, and `--audit` options.
136
150
  - `speclink --version` (alias `-v`) and `speclink --help` (alias `-h`).
137
151
 
138
- [Unreleased]: https://github.com/salan70/docbridge/compare/v0.4.0...HEAD
152
+ [Unreleased]: https://github.com/salan70/docbridge/compare/v0.4.1...HEAD
153
+ [0.4.1]: https://github.com/salan70/docbridge/releases/tag/v0.4.1
139
154
  [0.4.0]: https://github.com/salan70/docbridge/releases/tag/v0.4.0
140
155
  [0.3.0]: https://github.com/salan70/docbridge/releases/tag/v0.3.0
141
156
  [0.2.0]: https://github.com/salan70/docbridge/releases/tag/v0.2.0
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # DocBridge
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/docbridge.svg)](https://www.npmjs.com/package/docbridge)
3
4
  [![Japanese README](https://img.shields.io/badge/README-%E6%97%A5%E6%9C%AC%E8%AA%9E-blue)](docs/ja/README.md)
4
5
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/salan70/docbridge)
5
6
 
@@ -10,99 +11,49 @@ and Markdown documentation, enabling LSP-like experiences such as Hover,
10
11
  Definition, References, and Diagnostics across implementation and specification
11
12
  files.
12
13
 
13
- ## Motivation
14
-
15
- Modern software projects often suffer from a gap between implementation and documentation:
16
-
17
- - Code changes without documentation updates
18
- - Documentation changes without implementation updates
19
- - Difficulty finding which specifications relate to a given implementation
20
- - Difficulty finding which implementation relates to a given specification
21
- - AI coding agents missing relevant context during code modifications
22
-
23
- DocBridge makes relationships between code and documentation explicit, navigable, and machine-readable.
24
-
25
- ## Concept
14
+ ## Installation
26
15
 
27
- Traditional documentation tools often focus on one direction:
16
+ DocBridge is distributed as the `docbridge` npm package and is intended to run
17
+ with Bun:
28
18
 
29
- ```text
30
- Code -> Documentation
19
+ ```sh
20
+ bunx docbridge check
31
21
  ```
32
22
 
33
- DocBridge focuses on both directions:
34
-
35
- ```text
36
- Code <-> Documentation
37
- ```
23
+ The current release is
24
+ [v0.4.0](https://github.com/salan70/docbridge/releases/tag/v0.4.0), published
25
+ as `docbridge@0.4.0` on npm.
38
26
 
39
- DocBridge links supported code declarations to Markdown sections. TypeScript is
40
- scanned in-process; Swift and Dart are scanned through bundled first-party
41
- worker packages.
27
+ The npm package is Bun-only; Node.js runtime compatibility is not part of the
28
+ initial distribution. The package includes prebuilt Swift and Dart scanner
29
+ binaries for `darwin-arm64` and `linux-x64`. TypeScript and Markdown checks run
30
+ without scanner binaries. Configured Swift or Dart projects on unsupported
31
+ platforms report `code_scanner_unavailable` and name the supported platform
32
+ keys.
42
33
 
43
- ## Example
34
+ ## Quick Start
44
35
 
45
- TypeScript:
36
+ Run first-time setup in the project root:
46
37
 
47
- ```ts
48
- /**
49
- * @doc docs/auth.md#login-spec
50
- */
51
- export async function login() {
52
- // ...
53
- }
38
+ ```sh
39
+ bunx docbridge init
54
40
  ```
55
41
 
56
- Markdown:
57
-
58
- ```md
59
- <!-- @code src/auth/login.ts#login -->
60
- ## Login Spec
42
+ For agent-guided adoption, install `docbridge-adopt` and print setup commands.
43
+ The `docbridge-adopt` skill finishes adoption and installs the remaining
44
+ DocBridge skills after scope is confirmed:
61
45
 
62
- Login flow specification.
46
+ ```sh
47
+ bunx docbridge init-with-agent
63
48
  ```
64
49
 
65
- Swift and Dart use the same `@doc` and `@code` model. Their code fragments are
66
- the scanner-produced canonical IDs, so members are type-qualified:
67
-
68
- ```swift
69
- /// @doc docs/auth.md#login-spec
70
- public struct AuthService {
71
- public func login(email: String, password: String) {}
72
- }
73
- ```
50
+ Preview planned file operations without writing:
74
51
 
75
- ```md
76
- <!-- @code Sources/AuthService.swift#AuthService.login(email:password:) -->
77
- ## Login Spec
52
+ ```sh
53
+ bunx docbridge init --dry-run
78
54
  ```
79
55
 
80
- ## Scope
81
-
82
- DocBridge recognizes the following elements.
83
-
84
- Supported code declarations:
85
-
86
- - TypeScript top-level exported declarations: `function`, `class`,
87
- `abstract class`, `interface`, `type`, `const`, `enum`, and supported
88
- `declare` / named default forms
89
- - Swift public/open declarations and configured internal declarations:
90
- top-level and member types, functions, variables, constants, initializers,
91
- and extension members
92
- - Dart public declarations: top-level functions/variables, classes, enums,
93
- mixins, constructors, fields, accessors, methods, and extension members
94
-
95
- Supported Markdown elements:
96
-
97
- - ATX headings
98
- - HTML comments
99
- - `@code` annotations attached to the next heading
100
-
101
- Projects must define scan targets in `docbridge.config.json`. There is no
102
- implicit default configuration; when the config file is missing, DocBridge
103
- reports `config_file_invalid` and does not scan project files.
104
-
105
- Minimal TypeScript configuration:
56
+ You can also create `docbridge.config.json` manually:
106
57
 
107
58
  ```json
108
59
  {
@@ -117,66 +68,56 @@ Minimal TypeScript configuration:
117
68
  }
118
69
  ```
119
70
 
120
- Multilanguage configuration is language-keyed. The old `include.code` array
121
- shape is intentionally invalid; migrate it to a `typescript` entry:
71
+ Link an exported TypeScript declaration to a Markdown section:
122
72
 
123
- ```json
124
- {
125
- "include": {
126
- "code": {
127
- "typescript": { "patterns": ["src/**/*.ts"] },
128
- "swift": { "patterns": ["Sources/**/*.swift"] },
129
- "dart": { "patterns": ["lib/**/*.dart"] }
130
- },
131
- "docs": ["docs/**/*.md"]
132
- }
73
+ ```ts
74
+ /**
75
+ * @doc docs/auth.md#login-spec
76
+ */
77
+ export async function login() {
78
+ // ...
133
79
  }
134
80
  ```
135
81
 
136
- Swift and Dart projects must build their scanner workers in source checkouts
137
- before checking those languages. Run `just build-swift-scanner` for Swift and
138
- `just build-dart-scanner` for Dart, or use the native test recipes below.
82
+ Add the backlink in the Markdown file:
139
83
 
140
- ## Installation
84
+ ```md
85
+ <!-- @code src/auth/login.ts#login -->
86
+ ## Login Spec
141
87
 
142
- DocBridge is distributed as the `docbridge` npm package and is intended to run
143
- with Bun:
88
+ Login flow specification.
89
+ ```
90
+
91
+ Check the project:
144
92
 
145
93
  ```sh
146
94
  bunx docbridge check
147
95
  ```
148
96
 
149
- The npm package is Bun-only; Node.js runtime compatibility is not part of the
150
- initial distribution. The package includes prebuilt Swift and Dart scanner
151
- binaries for `darwin-arm64` and `linux-x64`. TypeScript and Markdown checks run
152
- without scanner binaries. Configured Swift or Dart projects on unsupported
153
- platforms report `code_scanner_unavailable` and name the supported platform
154
- keys.
155
-
156
- ## CLI
97
+ ## Usage
157
98
 
158
99
  Check links:
159
100
 
160
101
  ```sh
161
- just check
102
+ bunx docbridge check
162
103
  ```
163
104
 
164
- Check another root:
105
+ Check another project root:
165
106
 
166
107
  ```sh
167
- just check-example
108
+ bunx docbridge check --root examples/typescript
168
109
  ```
169
110
 
170
111
  Emit JSON:
171
112
 
172
113
  ```sh
173
- just check-example-json
114
+ bunx docbridge check --json
174
115
  ```
175
116
 
176
117
  Run audit diagnostics:
177
118
 
178
119
  ```sh
179
- just audit
120
+ bunx docbridge check --audit
180
121
  ```
181
122
 
182
123
  Audit diagnostics include:
@@ -186,21 +127,20 @@ Audit diagnostics include:
186
127
  List the linked counterparts of changed files:
187
128
 
188
129
  ```sh
189
- git diff --name-only | docbridge related --stdin
130
+ git diff --name-only | bunx docbridge related --stdin
190
131
  ```
191
132
 
192
133
  `docbridge related` is informational: it reports each counterpart and whether it
193
134
  is itself in the change set, and always exits `0` on success. Changed files can
194
135
  also be passed as positional arguments. Add `--gate` to report only the
195
136
  counterparts that are not themselves in the change set and exit `1` when any
196
- exist; `just related-gate` runs this over uncommitted changes. Both modes
197
- support `--root` and `--json`. See [docs/specs/cli.md](docs/specs/cli.md) for
198
- details.
137
+ exist. Both modes support `--root` and `--json`. See
138
+ [docs/specs/cli.md](docs/specs/cli.md) for details.
199
139
 
200
140
  Print the content of the linked counterparts of changed files:
201
141
 
202
142
  ```sh
203
- git diff --name-only | docbridge context --stdin
143
+ git diff --name-only | bunx docbridge context --stdin
204
144
  ```
205
145
 
206
146
  `docbridge context` answers "what do the linked counterparts say": full
@@ -214,14 +154,121 @@ tree has broken links. See [docs/specs/cli.md](docs/specs/cli.md) for details.
214
154
  Inspect the resolved link graph:
215
155
 
216
156
  ```sh
217
- docbridge graph
218
- docbridge graph --json --include-content
157
+ bunx docbridge graph
158
+ bunx docbridge graph --json --include-content
219
159
  ```
220
160
 
221
161
  `docbridge graph` prints the resolved endpoint graph, including resolvable
222
162
  one-way links. JSON output follows
223
163
  [schemas/graph-output.schema.json](schemas/graph-output.schema.json).
224
164
 
165
+ ## Why DocBridge
166
+
167
+ Modern software projects often suffer from a gap between implementation and
168
+ documentation:
169
+
170
+ - Code changes without documentation updates
171
+ - Documentation changes without implementation updates
172
+ - Difficulty finding which specifications relate to a given implementation
173
+ - Difficulty finding which implementation relates to a given specification
174
+ - AI coding agents missing relevant context during code modifications
175
+
176
+ DocBridge makes relationships between code and documentation explicit,
177
+ navigable, and machine-readable.
178
+
179
+ ## Concept
180
+
181
+ Traditional documentation tools often focus on one direction:
182
+
183
+ ```text
184
+ Code -> Documentation
185
+ ```
186
+
187
+ DocBridge focuses on both directions:
188
+
189
+ ```text
190
+ Code <-> Documentation
191
+ ```
192
+
193
+ DocBridge links supported code declarations to Markdown sections. TypeScript is
194
+ scanned in-process; Swift and Dart are scanned through bundled first-party
195
+ worker packages.
196
+
197
+ ## Supported Inputs
198
+
199
+ DocBridge recognizes the following elements.
200
+
201
+ Supported code declarations:
202
+
203
+ - TypeScript top-level exported declarations: `function`, `class`,
204
+ `abstract class`, `interface`, `type`, `const`, `enum`, and supported
205
+ `declare` / named default forms
206
+ - Swift public/open declarations and configured internal declarations:
207
+ top-level and member types, functions, variables, constants, initializers,
208
+ and extension members
209
+ - Dart public declarations: top-level functions/variables, classes, enums,
210
+ mixins, constructors, fields, accessors, methods, and extension members
211
+
212
+ Supported Markdown elements:
213
+
214
+ - ATX headings
215
+ - HTML comments
216
+ - `@code` annotations attached to the next heading
217
+
218
+ Swift and Dart use the same `@doc` and `@code` model. Their code fragments are
219
+ the scanner-produced canonical IDs, so members are type-qualified:
220
+
221
+ ```swift
222
+ /// @doc docs/auth.md#login-spec
223
+ public struct AuthService {
224
+ public func login(email: String, password: String) {}
225
+ }
226
+ ```
227
+
228
+ ```md
229
+ <!-- @code Sources/AuthService.swift#AuthService.login(email:password:) -->
230
+ ## Login Spec
231
+ ```
232
+
233
+ Projects must define scan targets in `docbridge.config.json`. There is no
234
+ implicit default configuration; when the config file is missing, DocBridge
235
+ reports `config_file_invalid` and does not scan project files.
236
+
237
+ Minimal TypeScript configuration:
238
+
239
+ ```json
240
+ {
241
+ "include": {
242
+ "code": {
243
+ "typescript": {
244
+ "patterns": ["src/**/*.ts"]
245
+ }
246
+ },
247
+ "docs": ["docs/**/*.md"]
248
+ }
249
+ }
250
+ ```
251
+
252
+ Multilanguage configuration is language-keyed. The old `include.code` array
253
+ shape is intentionally invalid; migrate it to a `typescript` entry:
254
+
255
+ ```json
256
+ {
257
+ "include": {
258
+ "code": {
259
+ "typescript": { "patterns": ["src/**/*.ts"] },
260
+ "swift": { "patterns": ["Sources/**/*.swift"] },
261
+ "dart": { "patterns": ["lib/**/*.dart"] }
262
+ },
263
+ "docs": ["docs/**/*.md"]
264
+ }
265
+ }
266
+ ```
267
+
268
+ Swift and Dart projects must build their scanner workers in source checkouts
269
+ before checking those languages. Run `just build-swift-scanner` for Swift and
270
+ `just build-dart-scanner` for Dart, or use the native test recipes below.
271
+
225
272
  ## AI agent integration
226
273
 
227
274
  DocBridge's link graph is built to be consumed by AI coding agents:
@@ -231,7 +278,9 @@ DocBridge's link graph is built to be consumed by AI coding agents:
231
278
  with `docbridge related --gate`, and PR reporting.
232
279
  - [examples/hooks](examples/hooks) — copyable agent hook scripts implementing
233
280
  those recipes.
234
- - [templates/skills](templates/skills) — distributable agent skills:
281
+ - [templates/skills](templates/skills) — distributable agent skills installed by
282
+ `docbridge init`; `docbridge init-with-agent` installs `docbridge-adopt`
283
+ first, then `docbridge-adopt` installs the companion skills:
235
284
  `docbridge-annotate`, `docbridge-sync`, `docbridge-adopt`, `docbridge-link`,
236
285
  and `docbridge-review`.
237
286
 
@@ -404,7 +453,7 @@ inside their worker packages.
404
453
 
405
454
  ## Roadmap
406
455
 
407
- Completed v0.1–v0.3 capabilities are documented above and in
456
+ Completed v0.1–v0.4 capabilities are documented above and in
408
457
  [CHANGELOG.md](CHANGELOG.md). The current roadmap tracks upcoming work only.
409
458
 
410
459
  v0.5:
@@ -1,2 +1,2 @@
1
- 4e8638f664e3cb08e36146dd03097d1dfe1c35be39b79219c6d633ea07e7742f speclink-swift-scanner
2
- ef5e2d41194493de9f3cea22bc8f268c35bbd0f69ff63e275e303b6476b658a1 speclink_dart_scanner
1
+ a2ec141fe5b365958bf3d7cceb5938b4b0e0acf0227791dce08a627a1b17e541 speclink-swift-scanner
2
+ 459d9e21cd1479c3604c9567ba38c1a59959e70578d52e853f7a591e666428a6 speclink_dart_scanner
@@ -1,2 +1,2 @@
1
- 4100cc8c861a24821fca240c758ba188a42f677a403fe40a76bac4271a918bfe speclink-swift-scanner
1
+ 14b5284afd5387b0734832b35585f6b72945b6eef0642075bb68e1343fb1965d speclink-swift-scanner
2
2
  2145eac2afd09696ced849e0196a2557d6f7041224f13da1d5ef21c552ecf7bc speclink_dart_scanner