@redpanda-data/docs-extensions-and-macros 4.13.0 → 4.13.2

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.
Files changed (49) hide show
  1. package/bin/doc-tools-mcp.js +15 -3
  2. package/bin/doc-tools.js +767 -2088
  3. package/bin/mcp-tools/property-docs.js +18 -0
  4. package/bin/mcp-tools/rpcn-docs.js +28 -3
  5. package/cli-utils/antora-utils.js +53 -2
  6. package/cli-utils/dependencies.js +313 -0
  7. package/cli-utils/diff-utils.js +273 -0
  8. package/cli-utils/doc-tools-utils.js +54 -0
  9. package/extensions/algolia-indexer/generate-index.js +134 -102
  10. package/extensions/algolia-indexer/index.js +70 -38
  11. package/extensions/collect-bloblang-samples.js +2 -1
  12. package/extensions/generate-rp-connect-categories.js +126 -67
  13. package/extensions/generate-rp-connect-info.js +291 -137
  14. package/macros/rp-connect-components.js +34 -5
  15. package/mcp/CLI_INTERFACE.adoc +384 -0
  16. package/mcp/COSTS.adoc +167 -0
  17. package/mcp/DEVELOPMENT.adoc +726 -0
  18. package/mcp/README.adoc +172 -0
  19. package/mcp/USER_GUIDE.adoc +1392 -0
  20. package/mcp/WRITER_EXTENSION_GUIDE.adoc +814 -0
  21. package/mcp/prompts/README.adoc +183 -0
  22. package/mcp/prompts/property-docs-guide.md +283 -0
  23. package/mcp/prompts/review-for-style.md +128 -0
  24. package/mcp/prompts/rpcn-connector-docs-guide.md +126 -0
  25. package/mcp/prompts/write-new-guide.md +222 -0
  26. package/mcp/team-standards/style-guide.md +321 -0
  27. package/mcp/templates/README.adoc +212 -0
  28. package/mcp/templates/prompt-review-template.md +80 -0
  29. package/mcp/templates/prompt-write-template.md +110 -0
  30. package/mcp/templates/resource-template.md +76 -0
  31. package/package.json +8 -5
  32. package/tools/add-commercial-names.js +207 -0
  33. package/tools/generate-cli-docs.js +6 -2
  34. package/tools/get-console-version.js +5 -0
  35. package/tools/get-redpanda-version.js +5 -0
  36. package/tools/property-extractor/compare-properties.js +3 -3
  37. package/tools/property-extractor/generate-handlebars-docs.js +14 -14
  38. package/tools/property-extractor/generate-pr-summary.js +46 -0
  39. package/tools/property-extractor/pr-summary-formatter.js +375 -0
  40. package/tools/redpanda-connect/README.adoc +403 -38
  41. package/tools/redpanda-connect/connector-binary-analyzer.js +588 -0
  42. package/tools/redpanda-connect/generate-rpcn-connector-docs.js +97 -34
  43. package/tools/redpanda-connect/parse-csv-connectors.js +1 -1
  44. package/tools/redpanda-connect/pr-summary-formatter.js +601 -0
  45. package/tools/redpanda-connect/report-delta.js +69 -2
  46. package/tools/redpanda-connect/rpcn-connector-docs-handler.js +1180 -0
  47. package/tools/redpanda-connect/templates/connector.hbs +38 -0
  48. package/tools/redpanda-connect/templates/intro.hbs +0 -20
  49. package/tools/redpanda-connect/update-nav.js +205 -0
@@ -0,0 +1,384 @@
1
+ = CLI Interface Contract
2
+ :toc:
3
+ :toclevels: 3
4
+
5
+ This document describes the CLI interface contract that the MCP server depends on. These contracts are verified by the CLI contract tests to ensure the MCP server continues to work as expected when the CLI changes.
6
+
7
+ The MCP server wraps the `npx doc-tools` CLI to provide a natural language interface to Claude Code. The CLI must maintain specific commands, flags, and output formats for the MCP server to function correctly.
8
+
9
+ == Command structure
10
+
11
+ All commands follow the pattern:
12
+
13
+ [,bash]
14
+ ----
15
+ npx doc-tools <command> [subcommand] [flags]
16
+ ----
17
+
18
+ == Top-level commands
19
+
20
+ === generate
21
+
22
+ Generate various types of documentation.
23
+
24
+ [,bash]
25
+ ----
26
+ npx doc-tools generate <subcommand> [flags]
27
+ ----
28
+
29
+ Subcommands are documented in the <<Generate subcommands>> section.
30
+
31
+ === get-redpanda-version
32
+
33
+ Get the latest Redpanda version information.
34
+
35
+ [,bash]
36
+ ----
37
+ npx doc-tools get-redpanda-version [--beta]
38
+ ----
39
+
40
+ *Output format:*
41
+
42
+ [,bash]
43
+ ----
44
+ REDPANDA_VERSION=v25.3.1
45
+ REDPANDA_DOCKER_TAG=docker.redpanda.com/redpandadata/redpanda:v25.3.1
46
+ REDPANDA_RELEASE_NOTES=https://github.com/redpanda-data/redpanda/releases/tag/v25.3.1
47
+ ----
48
+
49
+ *Flags:*
50
+
51
+ --beta:: Get the latest beta/RC version instead of stable (optional)
52
+
53
+ === get-console-version
54
+
55
+ Get the latest Redpanda Console version information.
56
+
57
+ [,bash]
58
+ ----
59
+ npx doc-tools get-console-version
60
+ ----
61
+
62
+ *Output format:*
63
+
64
+ [,bash]
65
+ ----
66
+ CONSOLE_VERSION=v2.7.2
67
+ CONSOLE_DOCKER_TAG=docker.redpanda.com/redpandadata/console:v2.7.2
68
+ CONSOLE_RELEASE_NOTES=https://github.com/redpanda-data/console/releases/tag/v2.7.2
69
+ ----
70
+
71
+ === --version
72
+
73
+ Display the doc-tools version.
74
+
75
+ [,bash]
76
+ ----
77
+ npx doc-tools --version
78
+ ----
79
+
80
+ *Output format:*
81
+
82
+ [,bash]
83
+ ----
84
+ <major>.<minor>.<patch>
85
+ ----
86
+
87
+ Example: `1.2.3`
88
+
89
+ == Generate subcommands
90
+
91
+ === property-docs
92
+
93
+ Generate Redpanda configuration property documentation.
94
+
95
+ [,bash]
96
+ ----
97
+ npx doc-tools generate property-docs --tag <version> [options]
98
+ ----
99
+
100
+ *Required flags:*
101
+
102
+ --tag:: Redpanda version to generate docs for (for example, `v25.3.1`, `25.3.1`, or `latest`)
103
+
104
+ *Optional flags:*
105
+
106
+ --generate-partials:: Generate AsciiDoc partials in addition to JSON
107
+ --cloud-support:: Include cloud support information
108
+ --overrides:: Path to property overrides JSON file
109
+
110
+ *Output:*
111
+
112
+ Creates one or more of:
113
+
114
+ * `modules/reference/partials/properties.json`
115
+ * `modules/reference/partials/cluster-properties.adoc` (with `--generate-partials`)
116
+ * `modules/reference/partials/broker-properties.adoc` (with `--generate-partials`)
117
+ * `modules/reference/partials/tunable-properties.adoc` (with `--generate-partials`)
118
+ * `modules/reference/partials/topic-properties.adoc` (with `--generate-partials`)
119
+
120
+ === metrics-docs
121
+
122
+ Generate Redpanda metrics documentation.
123
+
124
+ [,bash]
125
+ ----
126
+ npx doc-tools generate metrics-docs --tag <version>
127
+ ----
128
+
129
+ *Required flags:*
130
+
131
+ --tag:: Redpanda version to generate docs for
132
+
133
+ *Output:*
134
+
135
+ Creates `modules/reference/pages/public-metrics-reference.adoc`
136
+
137
+ === rpk-docs
138
+
139
+ Generate RPK command-line documentation.
140
+
141
+ [,bash]
142
+ ----
143
+ npx doc-tools generate rpk-docs --tag <version>
144
+ ----
145
+
146
+ *Required flags:*
147
+
148
+ --tag:: Redpanda version to generate docs for
149
+
150
+ *Output:*
151
+
152
+ Creates AsciiDoc files in `autogenerated/v<version>/rpk/`
153
+
154
+ === rpcn-connector-docs
155
+
156
+ Generate Redpanda Connect connector documentation.
157
+
158
+ [,bash]
159
+ ----
160
+ npx doc-tools generate rpcn-connector-docs [options]
161
+ ----
162
+
163
+ *Optional flags:*
164
+
165
+ --fetch-connectors:: Fetch connector definitions from Redpanda Connect repository
166
+ --draft-missing:: Create draft pages for missing connectors
167
+ --update-whats-new:: Update the what's new page
168
+ --include-bloblang:: Include Bloblang documentation
169
+ --data-dir:: Directory containing connector data
170
+ --old-data:: Path to previous connector data for comparison
171
+ --csv:: Export connector data as CSV
172
+ --overrides:: Path to overrides JSON file
173
+
174
+ *Output:*
175
+
176
+ Creates component documentation files in `modules/reference/pages/redpanda-connect/components/`
177
+
178
+ === helm-spec
179
+
180
+ Generate Helm chart specification documentation.
181
+
182
+ [,bash]
183
+ ----
184
+ npx doc-tools generate helm-spec [options]
185
+ ----
186
+
187
+ *Optional flags:*
188
+
189
+ --chart-dir:: Path to Helm chart directory
190
+ --tag:: Helm chart version
191
+ --readme:: Include README content
192
+ --output-dir:: Output directory for generated files
193
+ --output-suffix:: Suffix for output files
194
+
195
+ === cloud-regions
196
+
197
+ Generate cloud regions documentation.
198
+
199
+ [,bash]
200
+ ----
201
+ npx doc-tools generate cloud-regions [options]
202
+ ----
203
+
204
+ *Optional flags:*
205
+
206
+ --output:: Output file path
207
+ --format:: Output format (json, yaml, adoc)
208
+ --owner:: GitHub repository owner
209
+ --repo:: GitHub repository name
210
+ --path:: Path to regions file in repository
211
+ --ref:: Git reference (branch, tag, commit)
212
+ --template:: AsciiDoc template file
213
+ --dry-run:: Show what would be generated without writing files
214
+
215
+ === crd-spec
216
+
217
+ Generate Custom Resource Definition (CRD) specification documentation.
218
+
219
+ [,bash]
220
+ ----
221
+ npx doc-tools generate crd-spec --tag <version> [options]
222
+ npx doc-tools generate crd-spec --branch <branch> [options]
223
+ ----
224
+
225
+ *Required flags (one of):*
226
+
227
+ --tag:: Redpanda Operator version tag (for released content)
228
+ --branch:: Branch name (for in-progress content)
229
+
230
+ *Optional flags:*
231
+
232
+ --source-path:: Path to CRD source files
233
+ --depth:: Maximum depth for nested properties
234
+ --templates-dir:: Directory containing documentation templates
235
+ --output:: Output directory
236
+
237
+ === bundle-openapi
238
+
239
+ Bundle OpenAPI specifications.
240
+
241
+ [,bash]
242
+ ----
243
+ npx doc-tools generate bundle-openapi --tag <version> [options]
244
+ ----
245
+
246
+ *Required flags:*
247
+
248
+ --tag:: Redpanda version for API specifications
249
+
250
+ *Optional flags:*
251
+
252
+ --repo:: Repository to fetch from
253
+ --surface:: API surface to bundle (admin, connect, or both)
254
+ --out-admin:: Output path for admin API bundle
255
+ --out-connect:: Output path for connect API bundle
256
+ --admin-major:: Major version for admin API
257
+ --use-admin-major-version:: Use major version in admin API bundle
258
+ --quiet:: Suppress output messages
259
+
260
+ == Output format contracts
261
+
262
+ === Version commands
263
+
264
+ Version commands (`get-redpanda-version`, `get-console-version`) must output key-value pairs in the format:
265
+
266
+ [,bash]
267
+ ----
268
+ KEY=value
269
+ ----
270
+
271
+ Lines starting with `#` are treated as comments and ignored by the MCP server.
272
+
273
+ === Generate commands
274
+
275
+ Generate commands should:
276
+
277
+ * Write to stdout for informational messages
278
+ * Write to stderr for errors
279
+ * Exit with code 0 on success
280
+ * Exit with non-zero code on failure
281
+
282
+ The MCP server parses stdout to extract:
283
+
284
+ * File counts (for example, "Generated 342 properties")
285
+ * File paths created
286
+ * Success/failure status
287
+
288
+ == Error handling contracts
289
+
290
+ === Missing required parameters
291
+
292
+ Commands must exit with non-zero status when required parameters are missing.
293
+
294
+ Example:
295
+
296
+ [,bash]
297
+ ----
298
+ $ npx doc-tools generate property-docs
299
+ Error: Required flag --tag is missing
300
+ $ echo $?
301
+ 1
302
+ ----
303
+
304
+ === Invalid flags
305
+
306
+ Commands must exit with non-zero status when invalid flags are provided.
307
+
308
+ Example:
309
+
310
+ [,bash]
311
+ ----
312
+ $ npx doc-tools generate property-docs --invalid-flag-xyz
313
+ Error: Unknown flag: --invalid-flag-xyz
314
+ $ echo $?
315
+ 1
316
+ ----
317
+
318
+ === Nonexistent commands
319
+
320
+ The CLI must exit with non-zero status when nonexistent commands are called.
321
+
322
+ Example:
323
+
324
+ [,bash]
325
+ ----
326
+ $ npx doc-tools generate nonexistent-command
327
+ Error: Unknown command: nonexistent-command
328
+ $ echo $?
329
+ 1
330
+ ----
331
+
332
+ === Network errors
333
+
334
+ Network errors (for example, GitHub API failures) are acceptable for version commands, but:
335
+
336
+ * Must write error message to stderr
337
+ * Must exit with non-zero status
338
+ * Error message should indicate the network issue
339
+
340
+ == Version compatibility
341
+
342
+ The CLI must support the `--version` flag to output the current version.
343
+
344
+ Format: `<major>.<minor>.<patch>`
345
+
346
+ This allows the MCP server to verify compatibility and provide helpful error messages if the CLI version is incompatible.
347
+
348
+ == Stability guarantees
349
+
350
+ The MCP server depends on these CLI contracts remaining stable:
351
+
352
+ *Command names and subcommands* must not change without a major version bump.
353
+
354
+ *Required flags* must not be removed or renamed without a major version bump.
355
+
356
+ *Output formats* for version commands must remain parseable.
357
+
358
+ *Exit codes* must follow Unix conventions (0 = success, non-zero = failure).
359
+
360
+ *Optional flags* may be added without breaking the MCP server.
361
+
362
+ *New subcommands* may be added without breaking the MCP server.
363
+
364
+ == Testing
365
+
366
+ The `cli-contract.test.js` test suite verifies these contracts automatically. All tests must pass before releasing a new version of doc-tools that could affect the MCP server.
367
+
368
+ Test categories:
369
+
370
+ * Command structure - Verifies commands and subcommands exist
371
+ * Flag support - Verifies required and optional flags are present
372
+ * Output format - Verifies output can be parsed correctly
373
+ * Error handling - Verifies proper exit codes and error messages
374
+ * Version compatibility - Verifies version information is available
375
+
376
+ == Breaking changes
377
+
378
+ If a breaking change to the CLI is necessary:
379
+
380
+ . Update the CLI with the breaking change
381
+ . Increment the major version in package.json
382
+ . Update the MCP server to handle both old and new interfaces (if possible)
383
+ . Update the CLI contract tests to verify the new interface
384
+ . Update this document with the new contract
package/mcp/COSTS.adoc ADDED
@@ -0,0 +1,167 @@
1
+ = MCP Tool Costs
2
+ :description: Cost reference for Redpanda documentation MCP server tools
3
+
4
+ The typical cost range is $0.017 - $0.190 per operation.
5
+
6
+ Most operations cost between $0.03 - $0.08. Content review operations range from $0.017 (simple terminology checks) to $0.19 (comprehensive generated docs reviews).
7
+
8
+ == Cost factors
9
+
10
+ You control costs through:
11
+
12
+ * *Model selection*: Choose the appropriate model when starting Claude Code (Haiku for simple tasks, Sonnet for most work, Opus for complex reasoning)
13
+ * *Prompt caching*: The MCP server caches style guides and frequently-used content, reducing costs for repeated operations
14
+ * *Content size*: Larger documents and more comprehensive reviews increase costs proportionally
15
+
16
+ == Cost by tool
17
+
18
+ [cols="2m,4a,1a"]
19
+ |===
20
+ |Tool |Prompt |Cost (USD)
21
+
22
+ |get_antora_structure
23
+ |Get the Antora structure
24
+ |0.055
25
+
26
+ |get_redpanda_version
27
+ |Get the latest Redpanda version
28
+ |0.033
29
+
30
+ |get_console_version
31
+ |Get the latest Redpanda Console version
32
+ |0.033
33
+
34
+ |generate_property_docs
35
+ |Generate property docs for tag v25.3.1
36
+ |0.076
37
+
38
+ |generate_metrics_docs
39
+ |Generate metrics docs for tag v25.3.1
40
+ |0.072
41
+
42
+ |generate_rpk_docs
43
+ |Generate RPK docs for tag v25.3.1
44
+ |0.034
45
+
46
+ |generate_rpcn_connector_docs
47
+ |Generate Redpanda Connect connector docs
48
+ |0.072
49
+
50
+ |generate_helm_docs
51
+ |Generate Helm docs for tag v25.1.2
52
+ |0.052
53
+
54
+ |generate_crd_docs
55
+ |Generate CRD docs for tag operator/v25.3.1
56
+ |0.084
57
+
58
+ |generate_bundle_openapi
59
+ |Bundle OpenAPI for tag v25.3.1
60
+ |0.068
61
+
62
+ |generate_cloud_regions
63
+ |Generate cloud regions table
64
+ |0.051
65
+
66
+ |review_generated_docs
67
+ |Review the autogenerated metrics docs
68
+ |0.104 - 0.190
69
+
70
+ |review_content (terminology)
71
+ |Check terminology in a sentence
72
+ |0.017
73
+
74
+ |review_content (style)
75
+ |Review content for style guide compliance
76
+ |0.065
77
+
78
+ |review_content (comprehensive)
79
+ |Comprehensive content review
80
+ |0.062
81
+ |===
82
+
83
+ == How to measure costs
84
+
85
+ To track costs during testing:
86
+
87
+ . Run a single MCP tool operation.
88
+ . Use the `/cost` command to view accumulated costs.
89
+ . Record the cost for that operation.
90
+ . Restart Claude Code to reset costs for the next measurement.
91
+
92
+ Example:
93
+
94
+ [source,bash]
95
+ ----
96
+ # In Claude Code CLI
97
+ > Get the latest Redpanda version
98
+ > /cost
99
+ ----
100
+
101
+ The `/cost` command shows:
102
+
103
+ * Total cost for the session
104
+ * Duration (API time and wall time)
105
+ * Code changes made
106
+ * Usage breakdown by model (input/output tokens, cache usage)
107
+
108
+ === API time and wall time
109
+
110
+ *API time (API duration)*:: The total time the Claude API spent actively processing and generating responses. This is what you're billed for.
111
+
112
+ *Wall time (wall clock time)*:: The total elapsed time from start to finish of your session. This includes API processing time, network latency, time between requests, and time spent reading/thinking.
113
+
114
+ For example:
115
+ ----
116
+ Total duration (API): 52s
117
+ Total duration (wall): 3m 31s
118
+ ----
119
+
120
+ In this case:
121
+
122
+ * API used 52 seconds of compute time (billable)
123
+ * The session took 3 minutes 31 seconds total (user experience)
124
+ * The 159-second difference includes network time, reading responses, and pauses between operations
125
+
126
+ == Choosing the right model
127
+
128
+ The model you use significantly affects costs. Start Claude Code with the appropriate model for your work:
129
+
130
+ [source,bash]
131
+ ----
132
+ # Haiku - Fast and cheap (best for simple tasks)
133
+ claude --model haiku
134
+
135
+ # Sonnet - Balanced (default, good for most work)
136
+ claude --model sonnet
137
+
138
+ # Opus - Most capable (use for complex reasoning)
139
+ claude --model opus
140
+ ----
141
+
142
+ === Model recommendations by task
143
+
144
+ *Use Haiku for:*
145
+
146
+ * Generating documentation from structured data (properties, metrics, RPK commands)
147
+ * Simple content reviews focused on terminology or style
148
+ * Quick operations that don't require deep reasoning
149
+
150
+ *Use Sonnet for:*
151
+
152
+ * Comprehensive content reviews
153
+ * Working on complex documentation tasks
154
+ * Most day-to-day documentation work
155
+
156
+ *Use Opus for:*
157
+
158
+ * Extremely complex reasoning tasks
159
+ * Architectural decisions about documentation structure
160
+ * Currently not needed for most documentation tasks
161
+
162
+ == Cost optimization tips
163
+
164
+ * *Choose the right model*: Use Haiku for simple generation tasks, Sonnet for most work
165
+ * *Leverage caching*: The MCP server caches style guides and prompts - repeated operations in the same session are cheaper
166
+ * *Batch similar work*: Do multiple reviews or generations in one session to maximize cache benefits
167
+ * *Use focused reviews*: For content review, use `focus: "terminology"` or `focus: "style"` instead of `focus: "comprehensive"` when you only need specific feedback