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.
@@ -31,11 +31,11 @@
31
31
  },
32
32
  "language": {
33
33
  "type": "string",
34
- "enum": ["typescript", "swift", "dart"],
34
+ "enum": ["typescript", "swift", "dart", "rust"],
35
35
  "description": "Code language for code nodes."
36
36
  },
37
- "location": { "$ref": "#/$defs/location" },
38
- "range": { "$ref": "#/$defs/range" },
37
+ "location": { "$ref": "common-output.schema.json#/$defs/location" },
38
+ "range": { "$ref": "common-output.schema.json#/$defs/range" },
39
39
  "content": {
40
40
  "oneOf": [
41
41
  {
@@ -85,8 +85,8 @@
85
85
  "type": "string",
86
86
  "description": "Resolved target endpoint of the annotation edge."
87
87
  },
88
- "location": { "$ref": "#/$defs/location" },
89
- "range": { "$ref": "#/$defs/range" }
88
+ "location": { "$ref": "common-output.schema.json#/$defs/location" },
89
+ "range": { "$ref": "common-output.schema.json#/$defs/range" }
90
90
  }
91
91
  }
92
92
  },
@@ -112,7 +112,7 @@
112
112
  },
113
113
  "diagnostics": {
114
114
  "type": "array",
115
- "items": { "$ref": "#/$defs/diagnostic" }
115
+ "items": { "$ref": "common-output.schema.json#/$defs/diagnostic" }
116
116
  },
117
117
  "summary": {
118
118
  "type": "object",
@@ -136,51 +136,5 @@
136
136
  "diagnostics": { "type": "integer", "minimum": 0 }
137
137
  }
138
138
  }
139
- },
140
- "$defs": {
141
- "location": {
142
- "type": "object",
143
- "additionalProperties": false,
144
- "required": ["filePath", "line", "column"],
145
- "properties": {
146
- "filePath": { "type": "string" },
147
- "line": { "type": "integer", "minimum": 1 },
148
- "column": { "type": "integer", "minimum": 1 }
149
- }
150
- },
151
- "position": {
152
- "type": "object",
153
- "additionalProperties": false,
154
- "required": ["line", "column"],
155
- "properties": {
156
- "line": { "type": "integer", "minimum": 1 },
157
- "column": { "type": "integer", "minimum": 1 }
158
- }
159
- },
160
- "range": {
161
- "type": "object",
162
- "additionalProperties": false,
163
- "required": ["start", "end"],
164
- "properties": {
165
- "start": { "$ref": "#/$defs/position" },
166
- "end": { "$ref": "#/$defs/position" }
167
- }
168
- },
169
- "diagnostic": {
170
- "type": "object",
171
- "required": ["severity", "code", "target", "message"],
172
- "properties": {
173
- "severity": {
174
- "type": "string",
175
- "enum": ["error", "warning"]
176
- },
177
- "code": { "type": "string" },
178
- "target": { "type": "string" },
179
- "source": { "type": "string" },
180
- "message": { "type": "string" },
181
- "location": { "$ref": "#/$defs/location" },
182
- "range": { "$ref": "#/$defs/range" }
183
- }
184
- }
185
139
  }
186
140
  }
@@ -0,0 +1,122 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "scanner-worker.schema.json",
4
+ "title": "DocBridge Scanner Worker Protocol",
5
+ "description": "Request and response payloads exchanged with scanner workers.",
6
+ "oneOf": [{ "$ref": "#/$defs/request" }, { "$ref": "#/$defs/response" }],
7
+ "$defs": {
8
+ "language": {
9
+ "type": "string",
10
+ "enum": ["typescript", "swift", "dart", "rust"]
11
+ },
12
+ "codeSymbol": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": [
16
+ "kind",
17
+ "language",
18
+ "filePath",
19
+ "symbolName",
20
+ "canonicalId",
21
+ "endpoint",
22
+ "location"
23
+ ],
24
+ "properties": {
25
+ "kind": { "const": "code" },
26
+ "language": { "$ref": "#/$defs/language" },
27
+ "filePath": { "type": "string" },
28
+ "symbolName": { "type": "string" },
29
+ "canonicalId": { "type": "string" },
30
+ "endpoint": { "type": "string" },
31
+ "location": { "$ref": "common-output.schema.json#/$defs/location" },
32
+ "nameRange": { "$ref": "common-output.schema.json#/$defs/range" },
33
+ "declarationRange": { "$ref": "common-output.schema.json#/$defs/range" },
34
+ "signatureRange": { "$ref": "common-output.schema.json#/$defs/range" }
35
+ }
36
+ },
37
+ "link": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["source", "target", "location"],
41
+ "properties": {
42
+ "source": { "type": "string" },
43
+ "target": { "type": "string" },
44
+ "location": { "$ref": "common-output.schema.json#/$defs/location" },
45
+ "targetRange": { "$ref": "common-output.schema.json#/$defs/range" }
46
+ }
47
+ },
48
+ "requestFile": {
49
+ "type": "object",
50
+ "additionalProperties": false,
51
+ "required": ["filePath", "content"],
52
+ "properties": {
53
+ "filePath": { "type": "string" },
54
+ "content": { "type": "string" }
55
+ }
56
+ },
57
+ "options": {
58
+ "type": "object",
59
+ "additionalProperties": false,
60
+ "properties": {
61
+ "visibility": {
62
+ "type": "array",
63
+ "items": { "type": "string" }
64
+ }
65
+ }
66
+ },
67
+ "request": {
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": ["schemaVersion", "requestId", "language", "projectRoot", "files", "options"],
71
+ "properties": {
72
+ "schemaVersion": { "const": 1 },
73
+ "requestId": { "type": "string" },
74
+ "language": { "$ref": "#/$defs/language" },
75
+ "projectRoot": { "type": "string" },
76
+ "files": {
77
+ "type": "array",
78
+ "items": { "$ref": "#/$defs/requestFile" }
79
+ },
80
+ "options": { "$ref": "#/$defs/options" }
81
+ }
82
+ },
83
+ "responseFile": {
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "required": ["filePath", "symbols", "undocumentedSymbols", "links", "diagnostics"],
87
+ "properties": {
88
+ "filePath": { "type": "string" },
89
+ "symbols": {
90
+ "type": "array",
91
+ "items": { "$ref": "#/$defs/codeSymbol" }
92
+ },
93
+ "undocumentedSymbols": {
94
+ "type": "array",
95
+ "items": { "$ref": "#/$defs/codeSymbol" }
96
+ },
97
+ "links": {
98
+ "type": "array",
99
+ "items": { "$ref": "#/$defs/link" }
100
+ },
101
+ "diagnostics": {
102
+ "type": "array",
103
+ "items": { "$ref": "common-output.schema.json#/$defs/diagnostic" }
104
+ }
105
+ }
106
+ },
107
+ "response": {
108
+ "type": "object",
109
+ "additionalProperties": false,
110
+ "required": ["schemaVersion", "requestId", "language", "files"],
111
+ "properties": {
112
+ "schemaVersion": { "const": 1 },
113
+ "requestId": { "type": "string" },
114
+ "language": { "$ref": "#/$defs/language" },
115
+ "files": {
116
+ "type": "array",
117
+ "items": { "$ref": "#/$defs/responseFile" }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
@@ -15,9 +15,9 @@ nothing unless your DocBridge invocation differs from the examples inside.
15
15
  findings: fetch the flagged counterpart content with `docbridge context`,
16
16
  then update the counterpart or justify leaving it unchanged.
17
17
  - [`docbridge-adopt`](docbridge-adopt/SKILL.md) — adopt DocBridge in an existing
18
- TypeScript, Swift, or Dart project by confirming docs/code scope, creating
19
- or improving config, installing companion skills, and handling simple CI/hook
20
- setup.
18
+ TypeScript, Swift, Dart, or Rust project by confirming docs/code scope, creating
19
+ or improving config, installing companion skills, and handling simple CI or
20
+ Git-hook setup.
21
21
  - [`docbridge-link`](docbridge-link/SKILL.md) — link existing docs sections to
22
22
  existing supported code declarations through docs-first candidate discovery
23
23
  and section-level confirmation.
@@ -30,6 +30,5 @@ directory. The template is the source of truth; do not edit the symlinked
30
30
  copies in place. In-repository dogfood links require symlink-capable checkouts;
31
31
  external projects should use the copy-based installation above.
32
32
 
33
- The hook-side integration that complements these skills lives in
34
- [`examples/hooks/`](../../examples/hooks/) with recipes under
35
- [`docs/integrations/`](../../docs/integrations/).
33
+ The Git-hook and CI integration that complements these skills is described
34
+ under [`docs/integrations/`](../../docs/integrations/).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: docbridge-adopt
3
- description: Adopt DocBridge in an existing TypeScript, Swift, or Dart project. Use when asked to introduce DocBridge into a repository, choose docs/code scope, create or improve docbridge.config.json, and optionally wire simple CI or agent hooks.
3
+ description: Adopt DocBridge in an existing TypeScript, Swift, Dart, or Rust project. Use when asked to introduce DocBridge into a repository, choose docs/code scope, create or improve docbridge.config.json, and optionally wire simple CI or Git hooks.
4
4
  ---
5
5
 
6
6
  # docbridge-adopt
@@ -22,17 +22,17 @@ repo recipe such as `just check`, or
22
22
  1. **Survey the repository.** Inspect:
23
23
  - existing `docbridge.config.json`
24
24
  - Markdown docs structure and likely specification directories
25
- - TypeScript, Swift, or Dart source structure and public API locations
25
+ - TypeScript, Swift, Dart, or Rust source structure and public API locations
26
26
  - existing `@doc` / `@code` annotations
27
- - package scripts, CI files, git hooks, and agent hooks
27
+ - package scripts, CI files, and Git hooks
28
28
 
29
29
  2. **Recommend scope, then ask for confirmation.** Present concise options and
30
30
  your recommendation for:
31
31
  - docs scope: directories/files whose sections are likely specifications,
32
32
  contracts, behavior, constraints, or design decisions
33
- - code scope: language-keyed TypeScript, Swift, or Dart directories/files
33
+ - code scope: language-keyed TypeScript, Swift, Dart, or Rust directories/files
34
34
  whose supported declarations should be linkable
35
- - CI/hook mode: if any integration should be added now
35
+ - CI/Git-hook mode: if any integration should be added now
36
36
 
37
37
  Do not ask the user to rediscover obvious facts from the repository. Show
38
38
  your recommendation and the tradeoff, then wait for confirmation.
@@ -42,8 +42,8 @@ repo recipe such as `just check`, or
42
42
  `include.code` and `include.docs` globs.
43
43
  - Use the language-keyed `include.code` object. Do not write the old
44
44
  array form; for example, use `{ "typescript": { "patterns": [...] } }`,
45
- `{ "swift": { "patterns": [...] } }`, or
46
- `{ "dart": { "patterns": [...] } }`.
45
+ `{ "swift": { "patterns": [...] } }`, `{ "dart": { "patterns": [...] } }`,
46
+ or `{ "rust": { "patterns": [...] } }`.
47
47
  - If config exists, read it, explain the current scope, propose any
48
48
  improvement, and edit only after confirmation.
49
49
  - Never replace a user-authored config blindly.
@@ -52,11 +52,11 @@ repo recipe such as `just check`, or
52
52
  - After scope is confirmed and `docbridge.config.json` exists or has been
53
53
  intentionally left unchanged, install the rest of the distributable
54
54
  DocBridge skills for the same agent target.
55
- - Prefer the project-native DocBridge invocation. For example, run
56
- `docbridge init --yes --agent-target codex`, `docbridge init --yes
57
- --agent-target claude`, or `docbridge init --yes --agent-target both`
58
- from the project root. Use the target that matches the existing
59
- `.agents/` and/or `.claude/` setup.
55
+ - Prefer the project-native DocBridge invocation. From the project root, run
56
+ `docbridge init --yes --agent-target codex` for Codex,
57
+ `docbridge init --yes --agent-target claude` for Claude Code, or
58
+ `docbridge init --yes --agent-target both` for both. Use the target that
59
+ matches the existing `.agents/` and/or `.claude/` setup.
60
60
  - This command should leave an existing `docbridge.config.json` unchanged
61
61
  and copy any missing `docbridge-annotate`, `docbridge-link`,
62
62
  `docbridge-review`, and `docbridge-sync` skill directories. Do not use
@@ -65,7 +65,7 @@ repo recipe such as `just check`, or
65
65
  copy target paths from `templates/skills/docbridge-*` instead of silently
66
66
  skipping this step.
67
67
 
68
- 5. **Handle CI/hooks conservatively.**
68
+ 5. **Handle CI and Git hooks conservatively.**
69
69
  - If the existing setup is simple and the user confirmed the mode, implement
70
70
  it.
71
71
  - If the setup is complex or ambiguous, provide a concrete patch plan or
@@ -90,7 +90,7 @@ repo recipe such as `just check`, or
90
90
  notes as exclusions by default unless the user identifies specific sections
91
91
  as specifications.
92
92
  - Prefer supported public API declarations as link targets. TypeScript starts
93
- with top-level exported declarations; Swift and Dart also support member
93
+ with top-level exported declarations; Swift, Dart, and Rust also support member
94
94
  endpoints with scanner-produced canonical IDs.
95
95
  - Do not decide project workflow policy such as branch or PR strategy. Mention
96
96
  only what affects DocBridge adoption.
@@ -37,6 +37,7 @@ section:
37
37
 
38
38
  ```md
39
39
  <!-- @code src/auth/login.ts#login -->
40
+
40
41
  ## Login Spec
41
42
  ```
42
43
 
@@ -88,11 +89,11 @@ required. Optional text after the target is allowed and ignored
88
89
 
89
90
  ## Diagnosing check failures
90
91
 
91
- | Diagnostic | Meaning | Usual fix |
92
- | --- | --- | --- |
93
- | `doc_file_not_found` / `code_file_not_found` | target file not in the managed set | fix the path, or extend `docbridge.config.json` globs |
94
- | `doc_anchor_not_found` | file found, anchor wrong | regenerate the anchor from the exact heading text |
95
- | `doc_backlink_not_found` / `code_backlink_not_found` | one direction missing | add the missing `@code` or `@doc` side |
96
- | `unsupported_declaration` | `@doc` on an unsupported declaration | move the tag to a supported declaration |
97
- | `dangling_code_annotation` | text between `@code` and the heading | move the comment directly above the heading |
98
- | `invalid_link_target` | malformed `file#fragment` | rewrite the target per the rules above |
92
+ | Diagnostic | Meaning | Usual fix |
93
+ | ---------------------------------------------------- | ------------------------------------ | ----------------------------------------------------- |
94
+ | `doc_file_not_found` / `code_file_not_found` | target file not in the managed set | fix the path, or extend `docbridge.config.json` globs |
95
+ | `doc_anchor_not_found` | file found, anchor wrong | regenerate the anchor from the exact heading text |
96
+ | `doc_backlink_not_found` / `code_backlink_not_found` | one direction missing | add the missing `@code` or `@doc` side |
97
+ | `unsupported_declaration` | `@doc` on an unsupported declaration | move the tag to a supported declaration |
98
+ | `dangling_code_annotation` | text between `@code` and the heading | move the comment directly above the heading |
99
+ | `invalid_link_target` | malformed `file#fragment` | rewrite the target per the rules above |
@@ -7,7 +7,7 @@ description: Link existing Markdown specification sections to existing supported
7
7
 
8
8
  Create DocBridge annotations for existing docs and code. Work docs-first: choose
9
9
  Markdown sections that look like specifications, then propose supported
10
- TypeScript, Swift, or Dart declarations that implement or represent each
10
+ TypeScript, Swift, Dart, or Rust declarations that implement or represent each
11
11
  section.
12
12
 
13
13
  Run DocBridge with the project's native invocation: `docbridge` on `PATH`, a
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: docbridge-sync
3
- description: Triage DocBridge related-gate findings — linked counterparts of changed files that were not themselves updated. Use when a Stop-hook message, CI comment, or docbridge related --gate run flags unchanged counterparts, to judge divergence with docbridge context and then update or justify each one.
3
+ description: Triage DocBridge related-gate findings — linked counterparts of changed files that were not themselves updated. Use when a Git hook, CI comment, or docbridge related --gate run flags unchanged counterparts, to judge divergence with docbridge context and then update or justify each one.
4
4
  ---
5
5
 
6
6
  # docbridge-sync
@@ -16,8 +16,8 @@ repo recipe such as `just related-gate`, or
16
16
 
17
17
  ## Procedure
18
18
 
19
- 1. **Collect the violations.** Use the gate report you were given (Stop-hook
20
- message, CI comment), or produce one over the change set:
19
+ 1. **Collect the violations.** Use the gate report you were given (a Git
20
+ hook's output, a CI comment), or produce one over the change set:
21
21
 
22
22
  ```sh
23
23
  git diff --name-only HEAD | docbridge related --stdin --gate
@@ -62,7 +62,7 @@ repo recipe such as `just related-gate`, or
62
62
  the link; that defeats the graph the gate protects.
63
63
  - Do not rubber-stamp: if the counterpart content was not read, the judgment
64
64
  has no basis.
65
- - Updating a spec section to match changed code is a *decision about the
66
- contract*, not bookkeeping — when the change contradicts an explicit
65
+ - Updating a spec section to match changed code is a _decision about the
66
+ contract_, not bookkeeping — when the change contradicts an explicit
67
67
  documented promise, surface it to the user instead of quietly rewriting the
68
68
  promise.