docbridge 0.8.0 → 0.9.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 +74 -1
- package/README.md +55 -369
- package/dist/bin/darwin-arm64/SHA256SUMS +2 -2
- package/dist/bin/darwin-arm64/docbridge-swift-scanner +0 -0
- package/dist/bin/darwin-arm64/docbridge_dart_scanner +0 -0
- package/dist/bin/linux-x64/SHA256SUMS +2 -2
- package/dist/bin/linux-x64/docbridge-swift-scanner +1 -1
- package/dist/bin/linux-x64/docbridge_dart_scanner +0 -0
- package/dist/index.js +2598 -1112
- package/docs/README.md +66 -0
- package/docs/user/automation.md +104 -0
- package/docs/user/commands.md +67 -4
- package/docs/user/configuration.md +5 -4
- package/docs/user/getting-started.md +4 -4
- package/docs/user/linking.md +202 -0
- package/docs/user/troubleshooting.md +50 -18
- package/package.json +2 -1
- package/schemas/docbridge.links.schema.json +39 -0
- package/schemas/scanner-worker.schema.json +1 -0
- package/templates/skills/docbridge/SKILL.md +12 -13
- package/docs/user/agent-integration.md +0 -96
- package/docs/user/annotations.md +0 -173
- package/docs/user/link-review.md +0 -53
- package/docs/user/linking-workflow.md +0 -70
package/docs/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# DocBridge Documentation
|
|
2
|
+
|
|
3
|
+
Choose the shortest path for the task. User guides explain how to achieve an
|
|
4
|
+
outcome; specifications define exhaustive behavior; integration recipes adapt
|
|
5
|
+
the general workflow to a particular tool.
|
|
6
|
+
|
|
7
|
+
[日本語の入口](ja/README.md)
|
|
8
|
+
|
|
9
|
+
## Use DocBridge
|
|
10
|
+
|
|
11
|
+
These English guides are also installed with the npm package and available
|
|
12
|
+
through `docbridge docs show <name>`:
|
|
13
|
+
|
|
14
|
+
- [Getting started](user/getting-started.md) — install, configure, and validate
|
|
15
|
+
the first reciprocal link
|
|
16
|
+
- [Configuration](user/configuration.md) — choose roots, patterns, languages,
|
|
17
|
+
and visibility
|
|
18
|
+
- [Linking](user/linking.md) — select sections, author annotation pairs, and
|
|
19
|
+
review their meaning
|
|
20
|
+
- [Commands](user/commands.md) — choose between check, related, context, graph,
|
|
21
|
+
docs, and upgrade
|
|
22
|
+
- [Automation](user/automation.md) — connect agents, Git hooks, and CI
|
|
23
|
+
- [Troubleshooting](user/troubleshooting.md) — recover from configuration,
|
|
24
|
+
scanner, parsing, and link diagnostics
|
|
25
|
+
|
|
26
|
+
## Automate and integrate
|
|
27
|
+
|
|
28
|
+
- [Claude Code](integrations/claude-code.md)
|
|
29
|
+
- [Codex](integrations/codex.md)
|
|
30
|
+
- [Continuous integration](integrations/ci.md)
|
|
31
|
+
- [VS Code-compatible extension](../editors/vscode/README.md)
|
|
32
|
+
|
|
33
|
+
These pages contain client-specific setup and runnable recipes. The general
|
|
34
|
+
editing and gate policy stays in [Automation](user/automation.md).
|
|
35
|
+
|
|
36
|
+
## Understand the contracts
|
|
37
|
+
|
|
38
|
+
Normative command, configuration, diagnostic, scanning, link-resolution, and
|
|
39
|
+
language-server behavior lives under [Specifications](specs/cli.md). Start
|
|
40
|
+
with the specification for the interface whose exact contract you need:
|
|
41
|
+
|
|
42
|
+
- [CLI](specs/cli.md)
|
|
43
|
+
- [Configuration](specs/configuration.md)
|
|
44
|
+
- [Annotations](specs/annotations.md)
|
|
45
|
+
- [Scanning](specs/scanning.md)
|
|
46
|
+
- [Link resolution](specs/link-resolution.md)
|
|
47
|
+
- [Link manifest](specs/link-manifest.md)
|
|
48
|
+
- [Diagnostics](specs/diagnostics.md)
|
|
49
|
+
- [Language server](specs/lsp.md)
|
|
50
|
+
|
|
51
|
+
## Contribute to DocBridge
|
|
52
|
+
|
|
53
|
+
- [Contributor guide](../CONTRIBUTING.md)
|
|
54
|
+
- [Module architecture](contributing/architecture.md)
|
|
55
|
+
- [Writing guidelines](contributing/writing.md)
|
|
56
|
+
- [Documentation guidelines](contributing/documentation.md)
|
|
57
|
+
- [Testing](contributing/testing.md)
|
|
58
|
+
- [Commit messages](contributing/commits.md)
|
|
59
|
+
- [Pull requests](contributing/pull-requests.md)
|
|
60
|
+
- [Self-audit baseline](contributing/self-audit.md)
|
|
61
|
+
- [Dogfooding review, September 2026](reports/2026-09-dogfooding-review.md)
|
|
62
|
+
|
|
63
|
+
Architectural choices are recorded in [Decisions](decisions/README.md).
|
|
64
|
+
Completed delivery records are archived under
|
|
65
|
+
[Completed plans](plans/done/README.md). They are historical context, not
|
|
66
|
+
current user instructions.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Automate DocBridge with coding agents, Git hooks, and CI.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Automation
|
|
6
|
+
|
|
7
|
+
Use automation after `docbridge check` passes locally. Keep link validity as a
|
|
8
|
+
hard gate, and treat unchanged linked counterparts as review obligations rather
|
|
9
|
+
than automatic failures.
|
|
10
|
+
|
|
11
|
+
<!-- @code src/cli/init.ts#runInitWithAgent -->
|
|
12
|
+
|
|
13
|
+
## Invoking DocBridge
|
|
14
|
+
|
|
15
|
+
Run DocBridge through the project's normal command: `docbridge` on `PATH`, a
|
|
16
|
+
package-manager script, or a repository recipe such as `just check`. An agent
|
|
17
|
+
can discover the interface from `docbridge --help` and the packaged guides from
|
|
18
|
+
`docbridge docs list`.
|
|
19
|
+
|
|
20
|
+
Keep the DocBridge version in one place, such as the package manifest's
|
|
21
|
+
development dependency or a single version file that hooks and CI read. When
|
|
22
|
+
the same pin is copied into several scripts, the copies drift apart. After
|
|
23
|
+
changing the version, run `docbridge upgrade --check` to confirm that the CLI
|
|
24
|
+
and the installed skill match; see `docbridge docs show commands`.
|
|
25
|
+
|
|
26
|
+
`docbridge init` can create `docbridge.config.json` and install the
|
|
27
|
+
distributable `docbridge` skill for Codex, Claude Code, or both. To have an
|
|
28
|
+
agent choose the initial documentation and code scope, run:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
docbridge init-with-agent --agent-target codex
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use `claude` or `both` for the other supported targets. The command installs
|
|
35
|
+
the skill and prints the next command or prompt; it does not launch an agent.
|
|
36
|
+
|
|
37
|
+
<!-- @code src/core/context.ts#context -->
|
|
38
|
+
<!-- @code src/core/related.ts#related -->
|
|
39
|
+
|
|
40
|
+
## Editing workflow
|
|
41
|
+
|
|
42
|
+
Before editing a linked file, read its counterpart:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
docbridge context path/to/file
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After editing, inspect the change set:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
git diff --name-only | docbridge related --stdin --gate
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For every reported counterpart, make one explicit judgment:
|
|
55
|
+
|
|
56
|
+
- update it when behavior, contract, format, or constraints changed;
|
|
57
|
+
- leave it unchanged with a written, content-based justification when every
|
|
58
|
+
documented statement still holds; or
|
|
59
|
+
- fix the annotation pair when the link points to the wrong section or symbol.
|
|
60
|
+
|
|
61
|
+
Never remove a valid link just to silence the gate.
|
|
62
|
+
|
|
63
|
+
## Git hooks
|
|
64
|
+
|
|
65
|
+
Put shared checks in repository hooks rather than one agent's configuration.
|
|
66
|
+
A pre-commit hook can run `docbridge check` as a blocking validity gate and
|
|
67
|
+
then report related files from the staged set:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
git diff --cached --name-only | docbridge related --stdin --gate
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Add `docbridge context --stdin` when the report should include counterpart
|
|
74
|
+
content. Keep the related-file stage informational while the graph is sparse;
|
|
75
|
+
hooks must not rewrite files or replace the repository's normal quality gates.
|
|
76
|
+
Hooks can be bypassed, so pull-request CI remains the enforcement point.
|
|
77
|
+
|
|
78
|
+
## Continuous integration
|
|
79
|
+
|
|
80
|
+
Run `docbridge check` over the whole project as the hard link-validity gate. A
|
|
81
|
+
pull-request workflow can also pass the base-to-head file list to
|
|
82
|
+
`related --stdin --gate` and attach `context` output for reviewers. Fetch enough
|
|
83
|
+
Git history for the comparison and calculate the changed paths from the PR's
|
|
84
|
+
base and head commits.
|
|
85
|
+
|
|
86
|
+
The general contract belongs here. Copyable GitHub Actions steps and sticky PR
|
|
87
|
+
comment behavior belong in the [CI integration recipe](https://github.com/salan70/docbridge/blob/main/docs/integrations/ci.md).
|
|
88
|
+
|
|
89
|
+
## Agent-specific recipes
|
|
90
|
+
|
|
91
|
+
The distributable skill is under
|
|
92
|
+
[`templates/skills/docbridge`](https://github.com/salan70/docbridge/tree/main/templates/skills/docbridge).
|
|
93
|
+
The recipes below live in the repository, not in the installed package. For
|
|
94
|
+
client setup and prompt examples, use the specialized recipes:
|
|
95
|
+
|
|
96
|
+
- [Claude Code](https://github.com/salan70/docbridge/blob/main/docs/integrations/claude-code.md)
|
|
97
|
+
- [Codex](https://github.com/salan70/docbridge/blob/main/docs/integrations/codex.md)
|
|
98
|
+
- [CI](https://github.com/salan70/docbridge/blob/main/docs/integrations/ci.md)
|
|
99
|
+
|
|
100
|
+
## Next steps
|
|
101
|
+
|
|
102
|
+
- Read `docbridge docs show commands` for command output and exit behavior.
|
|
103
|
+
- Read `docbridge docs show linking` before adding or reviewing links.
|
|
104
|
+
- Read `docbridge docs show troubleshooting` when an automated check fails.
|
package/docs/user/commands.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Choose between check, related, context, and
|
|
2
|
+
description: Choose between check, related, context, graph, docs, and upgrade.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Commands
|
|
@@ -18,9 +18,9 @@ handled before project scanning, while each command validates its own options.
|
|
|
18
18
|
### `check`: validate the project
|
|
19
19
|
|
|
20
20
|
Run `docbridge check` before committing and in CI. It validates configuration,
|
|
21
|
-
annotations, targets,
|
|
22
|
-
for undocumented code declarations and unlinked
|
|
23
|
-
`--json` for machine-readable diagnostics.
|
|
21
|
+
annotations, targets, reciprocal links, and the optional link manifest. Add
|
|
22
|
+
`--audit` to include warnings for undocumented code declarations and unlinked
|
|
23
|
+
Markdown sections. Add `--json` for machine-readable diagnostics.
|
|
24
24
|
|
|
25
25
|
<!-- @code src/core/related.ts#related -->
|
|
26
26
|
|
|
@@ -57,8 +57,71 @@ Use `graph` for endpoints, edges, reciprocal pairs, and unresolved links across
|
|
|
57
57
|
the project. Passing file paths scopes the result to those files and their
|
|
58
58
|
direct counterparts. `--include-content` is available only with `--json`.
|
|
59
59
|
|
|
60
|
+
<!-- @code src/cli/upgrade.ts#runUpgrade -->
|
|
61
|
+
|
|
62
|
+
### `upgrade`: keep the CLI and skills in step
|
|
63
|
+
|
|
64
|
+
Run `docbridge upgrade --check` after a DocBridge release, or whenever a
|
|
65
|
+
project still carries agent assets from an older layout:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
docbridge upgrade --check
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
It is read-only. It reports the installed version, the latest stable release on
|
|
72
|
+
npm, the command to upgrade the CLI with your package manager, the state of the
|
|
73
|
+
managed `docbridge` skill, any leftover legacy skill directories, symlinks, and
|
|
74
|
+
files you have edited locally.
|
|
75
|
+
|
|
76
|
+
DocBridge never upgrades itself and never runs a package manager for you.
|
|
77
|
+
Upgrade the CLI with the printed command, then re-run `docbridge upgrade` so the
|
|
78
|
+
managed skill is reconciled from the new binary:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
docbridge upgrade --dry-run
|
|
82
|
+
docbridge upgrade --force --yes
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`--dry-run` prints the full plan without writing files. Without `--force`, an
|
|
86
|
+
existing skill directory is preserved and the migration is reported as pending.
|
|
87
|
+
`--force` replaces the managed `docbridge` skill and removes only the five known
|
|
88
|
+
legacy skill directories, and only when they are ordinary directories reached
|
|
89
|
+
through ordinary directories. A symlink, a regular file carrying a legacy name,
|
|
90
|
+
and anything under a symlinked `.agents/skills` or `.claude/skills` are reported
|
|
91
|
+
and left alone. Replacing the skill reproduces the packaged template exactly, so
|
|
92
|
+
a file you added inside it does not survive `--force`; keep local notes outside
|
|
93
|
+
the managed directory, or make it a symlink to a copy you own. Destructive operations ask for confirmation unless `--yes` is
|
|
94
|
+
passed, and a non-interactive run without `--yes` fails instead of replacing
|
|
95
|
+
local edits. Configuration, hooks, CI recipes, and your own files are never
|
|
96
|
+
touched.
|
|
97
|
+
|
|
98
|
+
## Update notification
|
|
99
|
+
|
|
100
|
+
On an interactive terminal, DocBridge prints one line to stderr when a newer
|
|
101
|
+
stable release is available. The check uses a short timeout and a daily
|
|
102
|
+
per-user cache, fails silently when offline, and never changes a command's
|
|
103
|
+
stdout or exit code. It is suppressed in CI, for `--json` output, for the
|
|
104
|
+
language server, when output is redirected, and when
|
|
105
|
+
`DOCBRIDGE_NO_UPDATE_CHECK=1` is set. That variable also stops `upgrade` from
|
|
106
|
+
contacting the registry, so it reports the latest version as unknown and only
|
|
107
|
+
describes local asset state.
|
|
108
|
+
|
|
60
109
|
## Common options
|
|
61
110
|
|
|
62
111
|
The project commands accept `--root <path>` when invoked outside the project
|
|
63
112
|
root. Run `docbridge <command> --help` for the exact options and exit behavior
|
|
64
113
|
of a command.
|
|
114
|
+
|
|
115
|
+
## Documentation commands
|
|
116
|
+
|
|
117
|
+
Use `docbridge docs list` to see the version-matched guides installed with the
|
|
118
|
+
CLI and `docbridge docs show <name>` to print one. The canonical names are
|
|
119
|
+
`getting-started`, `configuration`, `linking`, `commands`, `automation`, and
|
|
120
|
+
`troubleshooting`.
|
|
121
|
+
|
|
122
|
+
## Next steps
|
|
123
|
+
|
|
124
|
+
- Read `docbridge docs show linking` before creating or reviewing a pair.
|
|
125
|
+
- Read `docbridge docs show automation` before adding repository automation.
|
|
126
|
+
- Read `docbridge docs show troubleshooting` when a command reports a failure.
|
|
127
|
+
- Run `docbridge upgrade --check` after upgrading the CLI.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Configure docbridge.config.json: roots,
|
|
2
|
+
description: "Configure docbridge.config.json: roots, include patterns, languages, visibility."
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Configuration
|
|
@@ -40,7 +40,7 @@ Each language accepts an optional `visibility` array. Omitting it uses the
|
|
|
40
40
|
scanner default: TypeScript `public` and `protected` members, Swift `public`
|
|
41
41
|
and `open`, Dart `public` only, Rust unrestricted `pub`. A declaration
|
|
42
42
|
excluded by visibility is not an endpoint; an `@doc` on one is
|
|
43
|
-
`unsupported_declaration`. See `docbridge docs show
|
|
43
|
+
`unsupported_declaration`. See `docbridge docs show linking` for the
|
|
44
44
|
per-language rules, including Dart's leading-underscore privacy.
|
|
45
45
|
|
|
46
46
|
<!-- @code src/core/glob.ts#collectFiles -->
|
|
@@ -71,7 +71,8 @@ coverage gaps rather than every implementation detail or general prose file.
|
|
|
71
71
|
|
|
72
72
|
## Validate changes
|
|
73
73
|
|
|
74
|
-
Run `docbridge check` after editing configuration. A missing
|
|
75
|
-
|
|
74
|
+
Run `docbridge check` after editing configuration. A missing or unreadable
|
|
75
|
+
file, or invalid JSON, produces `config_file_invalid`. An unknown key produces
|
|
76
|
+
`config_unknown_key`, and a rejected value produces `config_invalid_value`. Use
|
|
76
77
|
`docbridge init --dry-run` to inspect a safe generated starting point without
|
|
77
78
|
overwriting an existing file.
|
|
@@ -66,10 +66,10 @@ A clean graph exits `0`. Broken links and invalid configuration exit `1`.
|
|
|
66
66
|
## Next steps
|
|
67
67
|
|
|
68
68
|
- Read `docbridge docs show configuration` before narrowing scan scope.
|
|
69
|
-
- Read `docbridge docs show
|
|
70
|
-
|
|
71
|
-
candidates.
|
|
72
|
-
- Read `docbridge docs show link-review` to audit existing links for meaning.
|
|
69
|
+
- Read `docbridge docs show linking` to choose sections, write annotations, and
|
|
70
|
+
review links for meaning.
|
|
73
71
|
- Read `docbridge docs show commands` to choose an inspection command.
|
|
72
|
+
- Read `docbridge docs show automation` before adding hooks, CI, or an agent
|
|
73
|
+
workflow.
|
|
74
74
|
- Read `docbridge docs show troubleshooting` when `check` reports a diagnostic.
|
|
75
75
|
- Add `docbridge check` to CI after the local graph passes.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Choose, create, and semantically review @doc and @code links.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Linking
|
|
6
|
+
|
|
7
|
+
DocBridge connects supported code declarations to Markdown headings. This
|
|
8
|
+
guide covers the complete workflow: choose meaningful sections, create a
|
|
9
|
+
reciprocal annotation pair, and review whether the relationship is still true.
|
|
10
|
+
|
|
11
|
+
## Choose what to link
|
|
12
|
+
|
|
13
|
+
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.
|
|
17
|
+
|
|
18
|
+
Prefer supported public API declarations as code targets. Do not force a link
|
|
19
|
+
when no declaration implements or represents the section, and do not use link
|
|
20
|
+
annotations to encode branch, review, or release policy.
|
|
21
|
+
|
|
22
|
+
## Propose candidates docs-first
|
|
23
|
+
|
|
24
|
+
1. Confirm which documentation directories are in scope.
|
|
25
|
+
2. Prioritize unlinked specification sections.
|
|
26
|
+
3. Propose no more than three code symbols per section, with a short reason and
|
|
27
|
+
any uncertainty.
|
|
28
|
+
4. Classify each section as adopt, exclude, or hold.
|
|
29
|
+
5. Add annotations only after the section-level decision is clear.
|
|
30
|
+
|
|
31
|
+
Use `docbridge check --audit` to find unlinked sections and undocumented public
|
|
32
|
+
symbols. Audit diagnostics are candidates for judgment, not instructions to
|
|
33
|
+
link every item.
|
|
34
|
+
|
|
35
|
+
<!-- @code src/core/links.ts#parseLinkTarget -->
|
|
36
|
+
|
|
37
|
+
## Target grammar
|
|
38
|
+
|
|
39
|
+
Both annotations take a project-root-relative `file#fragment` target:
|
|
40
|
+
|
|
41
|
+
- use `/` path separators;
|
|
42
|
+
- include both file and fragment;
|
|
43
|
+
- do not target the file that contains the annotation (same-file targets are invalid);
|
|
44
|
+
- do not use `./`, `../`, absolute paths, or whitespace inside the target; and
|
|
45
|
+
- optionally add human-readable text after the target.
|
|
46
|
+
|
|
47
|
+
One declaration may have multiple `@doc` tags, and one heading may have
|
|
48
|
+
multiple `@code` comments. Each pair is independent. Repeating the same target
|
|
49
|
+
from the same source produces `duplicate_link`.
|
|
50
|
+
|
|
51
|
+
## Code to documentation
|
|
52
|
+
|
|
53
|
+
Put `@doc` in the declaration's documentation comment:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
/** @doc docs/auth.md#login-flow */
|
|
57
|
+
export function login(): void {}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```swift
|
|
61
|
+
/// @doc docs/auth.md#login-flow
|
|
62
|
+
public func login(email: String, password: String) {}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```dart
|
|
66
|
+
/// @doc docs/auth.md#login-flow
|
|
67
|
+
void login(String email, String password) {}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```rust
|
|
71
|
+
/// @doc docs/auth.md#login-flow
|
|
72
|
+
pub fn login(email: &str, password: &str) {}
|
|
73
|
+
```
|
|
74
|
+
|
|
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.
|
|
78
|
+
|
|
79
|
+
### TypeScript declarations
|
|
80
|
+
|
|
81
|
+
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.
|
|
86
|
+
|
|
87
|
+
Members use type-qualified IDs without parameter signatures, such as
|
|
88
|
+
`AuthService.login` and `AuthService.constructor`. Visibility defaults to
|
|
89
|
+
`public` and `protected`; configure `private` explicitly. Anonymous default
|
|
90
|
+
exports, namespaces, re-exports, multi-declarator constants, computed member
|
|
91
|
+
names, enum members, and call/index/construct signatures are not endpoints.
|
|
92
|
+
|
|
93
|
+
### Swift declarations
|
|
94
|
+
|
|
95
|
+
Supported forms include top-level and member types, functions, variables,
|
|
96
|
+
constants, initializers, actors, protocols, and extension members. Visibility
|
|
97
|
+
defaults to `public` and `open`; configure `internal` explicitly. Member IDs
|
|
98
|
+
include argument labels, for example
|
|
99
|
+
`AuthService.login(email:password:)`.
|
|
100
|
+
|
|
101
|
+
### Dart declarations
|
|
102
|
+
|
|
103
|
+
Supported forms include top-level functions, accessors, and variables; classes,
|
|
104
|
+
enums, mixins, constructors, fields, and methods; and extension members. Dart
|
|
105
|
+
supports public endpoints only. Any canonical-ID segment beginning with `_` is
|
|
106
|
+
private. Member IDs omit parameter signatures; setters end in `=`, the unnamed
|
|
107
|
+
constructor ends in `.new`, and named constructors retain their name.
|
|
108
|
+
|
|
109
|
+
### Rust declarations
|
|
110
|
+
|
|
111
|
+
Supported forms are modules, structs, enums, free functions, and inherent
|
|
112
|
+
`impl` methods. Visibility defaults to unrestricted `pub`; configure `private`
|
|
113
|
+
to include non-`pub` items. Trait definitions and implementations, macros,
|
|
114
|
+
constants, statics, unions, and extern blocks are not endpoints. IDs use `::`
|
|
115
|
+
qualification, such as `TypingEngine::advance`.
|
|
116
|
+
|
|
117
|
+
<!-- @code src/core/markdown.ts#scanMarkdown -->
|
|
118
|
+
|
|
119
|
+
## Documentation to code
|
|
120
|
+
|
|
121
|
+
Place a standalone HTML comment immediately before the linked ATX heading.
|
|
122
|
+
Zero to three leading spaces and blank lines before the heading are allowed;
|
|
123
|
+
other intervening content produces `dangling_code_annotation`.
|
|
124
|
+
|
|
125
|
+
```md
|
|
126
|
+
<!-- @code src/auth.ts#login -->
|
|
127
|
+
|
|
128
|
+
## Login Flow
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Use the scanner-produced canonical symbol ID exactly.
|
|
132
|
+
|
|
133
|
+
## Heading anchors and reciprocity
|
|
134
|
+
|
|
135
|
+
DocBridge creates anchors from ATX headings only. It lowercases the heading,
|
|
136
|
+
collapses runs of whitespace and punctuation to `-`, preserves Unicode letters
|
|
137
|
+
and numbers, and removes leading and trailing hyphens. `## Login Spec (v2)` is
|
|
138
|
+
`#login-spec-v2`.
|
|
139
|
+
|
|
140
|
+
Empty headings have no anchor; a `@code` annotation attached to an empty
|
|
141
|
+
heading produces `dangling_code_annotation`. Duplicate non-empty anchors in
|
|
142
|
+
one file produce `duplicate_doc_anchor`; DocBridge does not add GitHub-style
|
|
143
|
+
numeric suffixes.
|
|
144
|
+
Each direction is validated independently, so a resolving target can still
|
|
145
|
+
report a missing backlink. Run `docbridge check` after every edit.
|
|
146
|
+
|
|
147
|
+
<!-- @code src/core/link-manifest.ts#loadLinkManifest -->
|
|
148
|
+
|
|
149
|
+
## Declare links in a manifest
|
|
150
|
+
|
|
151
|
+
Some teams do not accept tool-specific markers in their source files. Those
|
|
152
|
+
projects can declare every link in an optional root file
|
|
153
|
+
`docbridge.links.json` and write no annotation at all. Annotation linking
|
|
154
|
+
stays the recommended style, and the two styles work together in one project.
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"$schema": "./node_modules/docbridge/schemas/docbridge.links.schema.json",
|
|
159
|
+
"links": [
|
|
160
|
+
{
|
|
161
|
+
"code": "src/auth.ts#AuthService.login",
|
|
162
|
+
"doc": "docs/auth.md#login-flow",
|
|
163
|
+
"note": "optional, for human readers only"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
One entry declares both directions, so a manifest link never reports a missing
|
|
170
|
+
backlink. DocBridge checks only that both targets exist. `check`, `related`,
|
|
171
|
+
`context`, `graph`, and editor navigation treat the result exactly like an
|
|
172
|
+
annotation pair.
|
|
173
|
+
|
|
174
|
+
A `code` target whose file is in scope but whose symbol does not exist reports
|
|
175
|
+
`code_symbol_not_found` with a `Did you mean` suggestion; this diagnostic is
|
|
176
|
+
specific to the manifest. An entry that repeats an existing link, whether from
|
|
177
|
+
another entry or from an annotation, reports `duplicate_link`.
|
|
178
|
+
|
|
179
|
+
The cost is that a declared link is invisible to someone reading the code or
|
|
180
|
+
the document. Run `related --gate` in continuous integration so a change to
|
|
181
|
+
one side still surfaces the other.
|
|
182
|
+
|
|
183
|
+
## Semantic link review
|
|
184
|
+
|
|
185
|
+
`docbridge check` proves mechanics. A semantic review asks whether each linked
|
|
186
|
+
section and symbol still describe the same behavior or contract.
|
|
187
|
+
|
|
188
|
+
1. Run `docbridge graph --json --include-content` and read diagnostics first.
|
|
189
|
+
2. Review one documentation file at a time and read both endpoints.
|
|
190
|
+
3. Compare behavior, inputs, outputs, constraints, and design intent.
|
|
191
|
+
4. Report High findings for wrong or stale links, Medium for partial or
|
|
192
|
+
ambiguous relationships, and Low for cleanup or excessive linkage.
|
|
193
|
+
5. Include both endpoints, evidence, and a recommended fix for each finding.
|
|
194
|
+
|
|
195
|
+
Do not edit or remove annotations merely because the relationship is uncertain.
|
|
196
|
+
Prefer fewer precise links over broad many-to-many relationships.
|
|
197
|
+
|
|
198
|
+
## Next steps
|
|
199
|
+
|
|
200
|
+
- Run `docbridge docs show commands` to inspect the graph or related content.
|
|
201
|
+
- Run `docbridge docs show automation` before wiring hooks or CI.
|
|
202
|
+
- Run `docbridge docs show troubleshooting` for named diagnostics.
|
|
@@ -10,14 +10,23 @@ stderr. Use `docbridge <command> --help` for invocation errors and
|
|
|
10
10
|
|
|
11
11
|
## Configuration errors
|
|
12
12
|
|
|
13
|
-
`config_file_invalid` means `docbridge.config.json` is missing,
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
`config_file_invalid` means `docbridge.config.json` is missing, cannot be read
|
|
14
|
+
(for example, the path is a directory or lacks read permission), or is not
|
|
15
|
+
valid JSON. The message says the file was not found in both of the first two
|
|
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.
|
|
16
19
|
|
|
17
|
-
`config_unknown_key`
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
`config_unknown_key` means a parsed file has a key DocBridge does not know,
|
|
21
|
+
such as a misspelled property. `config_invalid_value` means a known key has a
|
|
22
|
+
value DocBridge rejects, such as an unsupported language, an empty pattern
|
|
23
|
+
list, or a pattern with the wrong file suffix. Compare the file with
|
|
24
|
+
[Configuration](configuration.md), and confirm that include patterns match
|
|
25
|
+
real files relative to the selected `--root`.
|
|
26
|
+
|
|
27
|
+
The same three codes apply to an optional `docbridge.links.json` link manifest.
|
|
28
|
+
When that file cannot be read or parsed, the CLI prints guidance to repair or
|
|
29
|
+
delete it. See [Linking](linking.md) for its format.
|
|
21
30
|
|
|
22
31
|
## Scanner errors
|
|
23
32
|
|
|
@@ -32,21 +41,36 @@ converting it into a broken link. Check that the source parses with the
|
|
|
32
41
|
project's own toolchain, then reproduce with the smallest configured file
|
|
33
42
|
set.
|
|
34
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
|
|
47
|
+
`code_scanner_failed`, the worker ran correctly; the source itself did not
|
|
48
|
+
parse.
|
|
49
|
+
|
|
50
|
+
`file_read_error` means a file matched by the configuration could not be read,
|
|
51
|
+
for example because of permissions or a broken symbolic link. The message
|
|
52
|
+
contains the operating-system reason.
|
|
53
|
+
|
|
35
54
|
## Link-authoring errors
|
|
36
55
|
|
|
37
56
|
These codes appear while writing `@doc` / `@code` pairs:
|
|
38
57
|
|
|
39
|
-
| Diagnostic | Meaning
|
|
40
|
-
| ---------------------------------------------------- |
|
|
41
|
-
| `doc_file_not_found` / `code_file_not_found` | target file not in the managed set
|
|
42
|
-
| `doc_anchor_not_found` | file found, anchor wrong
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
58
|
+
| Diagnostic | Meaning | Usual fix |
|
|
59
|
+
| ---------------------------------------------------- | ----------------------------------------- | --------------------------------------------------------- |
|
|
60
|
+
| `doc_file_not_found` / `code_file_not_found` | target file not in the managed set | fix the path, or extend `docbridge.config.json` globs |
|
|
61
|
+
| `doc_anchor_not_found` | file found, anchor wrong | regenerate the anchor from the exact heading text |
|
|
62
|
+
| `code_symbol_not_found` | manifest names a symbol that is not there | rename the entry, or follow the `Did you mean` suggestion |
|
|
63
|
+
| `doc_backlink_not_found` / `code_backlink_not_found` | one direction missing | add the missing `@code` or `@doc` side |
|
|
64
|
+
| `unsupported_declaration` | `@doc` on an unsupported declaration | move the tag to a supported declaration |
|
|
65
|
+
| `dangling_code_annotation` | text between `@code` and the heading | move the comment directly above the heading |
|
|
66
|
+
| `invalid_link_target` | malformed `file#fragment` | rewrite the target; see `docs show linking` |
|
|
67
|
+
| `duplicate_doc_anchor` | two headings share an anchor in one file | rename one heading so anchors stay unique |
|
|
68
|
+
| `duplicate_code_symbol` | two annotated declarations share an ID | keep one `@doc` per canonical ID in that file |
|
|
69
|
+
| `duplicate_link` | the same source repeats the same target | remove the extra annotation |
|
|
70
|
+
|
|
71
|
+
`undocumented_symbol` and `unlinked_doc_section` appear only with
|
|
72
|
+
`docbridge check --audit`. They are warnings that list unlinked endpoints, not
|
|
73
|
+
authoring errors.
|
|
50
74
|
|
|
51
75
|
Use `docbridge graph --json` to inspect resolved and one-way edges. Use
|
|
52
76
|
`docbridge context <file>` to confirm which counterpart content DocBridge can
|
|
@@ -59,3 +83,11 @@ currently resolve.
|
|
|
59
83
|
Unknown commands, unknown options, missing values, invalid roots, and missing
|
|
60
84
|
required inputs exit `1`, write to stderr, and leave stdout empty. These are not
|
|
61
85
|
included in diagnostic JSON because the project scan did not run.
|
|
86
|
+
|
|
87
|
+
`docbridge upgrade --force` is one of these when it would replace or remove a
|
|
88
|
+
managed skill directory without a terminal to confirm on. Re-run it with
|
|
89
|
+
`--yes`, or inspect the plan first with `docbridge upgrade --check` or
|
|
90
|
+
`docbridge upgrade --force --dry-run`.
|
|
91
|
+
|
|
92
|
+
When `docbridge docs show <name>` rejects a name, use a name printed by
|
|
93
|
+
`docbridge docs list`. Former guide names are no longer accepted.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docbridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/bun": "^1.3.14",
|
|
45
45
|
"ajv": "^8.20.0",
|
|
46
|
+
"markdown-it": "15.0.1",
|
|
46
47
|
"oxfmt": "0.57.0",
|
|
47
48
|
"oxlint": "1.73.0",
|
|
48
49
|
"typescript": "^5.9.0"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DocBridge Link Manifest",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["links"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"links": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": { "$ref": "#/$defs/link" }
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"$defs": {
|
|
17
|
+
"link": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"required": ["code", "doc"],
|
|
21
|
+
"properties": {
|
|
22
|
+
"code": {
|
|
23
|
+
"description": "Code endpoint as file#canonicalId, relative to the project root.",
|
|
24
|
+
"type": "string",
|
|
25
|
+
"pattern": "^[^/\\\\#\\s][^\\\\#\\s]*#[^#\\s]+$"
|
|
26
|
+
},
|
|
27
|
+
"doc": {
|
|
28
|
+
"description": "Documentation endpoint as file#anchor, relative to the project root.",
|
|
29
|
+
"type": "string",
|
|
30
|
+
"pattern": "^[^/\\\\#\\s][^\\\\#\\s]*\\.md#[^#\\s]+$"
|
|
31
|
+
},
|
|
32
|
+
"note": {
|
|
33
|
+
"description": "Free-form text for human readers. It reaches no command output.",
|
|
34
|
+
"type": "string"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"canonicalId": { "type": "string" },
|
|
30
30
|
"endpoint": { "type": "string" },
|
|
31
31
|
"location": { "$ref": "common-output.schema.json#/$defs/location" },
|
|
32
|
+
"isMember": { "type": "boolean" },
|
|
32
33
|
"nameRange": { "$ref": "common-output.schema.json#/$defs/range" },
|
|
33
34
|
"declarationRange": { "$ref": "common-output.schema.json#/$defs/range" },
|
|
34
35
|
"signatureRange": { "$ref": "common-output.schema.json#/$defs/range" }
|