@redpanda-data/docs-extensions-and-macros 4.13.1 → 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 (33) 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/package.json +4 -3
  16. package/tools/add-commercial-names.js +207 -0
  17. package/tools/generate-cli-docs.js +6 -2
  18. package/tools/get-console-version.js +5 -0
  19. package/tools/get-redpanda-version.js +5 -0
  20. package/tools/property-extractor/compare-properties.js +3 -3
  21. package/tools/property-extractor/generate-handlebars-docs.js +14 -14
  22. package/tools/property-extractor/generate-pr-summary.js +46 -0
  23. package/tools/property-extractor/pr-summary-formatter.js +375 -0
  24. package/tools/redpanda-connect/README.adoc +403 -38
  25. package/tools/redpanda-connect/connector-binary-analyzer.js +588 -0
  26. package/tools/redpanda-connect/generate-rpcn-connector-docs.js +97 -34
  27. package/tools/redpanda-connect/parse-csv-connectors.js +1 -1
  28. package/tools/redpanda-connect/pr-summary-formatter.js +601 -0
  29. package/tools/redpanda-connect/report-delta.js +69 -2
  30. package/tools/redpanda-connect/rpcn-connector-docs-handler.js +1180 -0
  31. package/tools/redpanda-connect/templates/connector.hbs +38 -0
  32. package/tools/redpanda-connect/templates/intro.hbs +0 -20
  33. package/tools/redpanda-connect/update-nav.js +205 -0
@@ -0,0 +1,375 @@
1
+ /**
2
+ * Format property diff data into a PR-friendly summary
3
+ * Outputs a console-parseable format for GitHub PRs
4
+ *
5
+ * This module generates GitHub PR-ready summaries from property comparison data.
6
+ * It's automatically invoked by doc-tools during property docs generation when
7
+ * comparing versions (e.g., doc-tools generate property-docs --tag v25.3.3 --diff v25.3.1)
8
+ *
9
+ * The summary includes:
10
+ * - High-level statistics (new/changed/removed properties)
11
+ * - Breaking change warnings
12
+ * - Missing description alerts
13
+ * - Action items for technical writers
14
+ * - Detailed tables with property information
15
+ *
16
+ * Usage:
17
+ * const { printPRSummary } = require('./pr-summary-formatter');
18
+ * const diffData = require('./path/to/diff.json');
19
+ * printPRSummary(diffData);
20
+ *
21
+ * Input format (diff data from compare-properties.js):
22
+ * {
23
+ * comparison: { oldVersion, newVersion, timestamp },
24
+ * summary: { newProperties, changedDefaults, ... },
25
+ * details: { newProperties: [...], changedDefaults: [...], ... }
26
+ * }
27
+ */
28
+
29
+ /**
30
+ * Generate a PR-friendly summary for property changes
31
+ * @param {object} diffData - Diff data from compareProperties
32
+ * @returns {string} Formatted summary
33
+ */
34
+ function generatePRSummary(diffData) {
35
+ const lines = [];
36
+
37
+ // Header with delimiters for GitHub Action parsing
38
+ lines.push('<!-- PR_SUMMARY_START -->');
39
+ lines.push('');
40
+
41
+ // Quick Summary Section
42
+ lines.push('## 📋 Redpanda Property Documentation Update');
43
+ lines.push('');
44
+ lines.push(`**Version:** ${diffData.comparison.oldVersion} → ${diffData.comparison.newVersion}`);
45
+ lines.push('');
46
+
47
+ // High-level stats
48
+ const stats = diffData.summary;
49
+ const hasChanges = Object.values(stats).some(v => v > 0);
50
+
51
+ if (!hasChanges) {
52
+ lines.push('Done: **No changes detected** - Documentation is up to date');
53
+ lines.push('');
54
+ lines.push('<!-- PR_SUMMARY_END -->');
55
+ return lines.join('\n');
56
+ }
57
+
58
+ lines.push('### Summary');
59
+ lines.push('');
60
+
61
+ if (stats.newProperties > 0) {
62
+ lines.push(`- **${stats.newProperties}** new propert${stats.newProperties !== 1 ? 'ies' : 'y'}`);
63
+ }
64
+
65
+ if (stats.changedDefaults > 0) {
66
+ lines.push(`- **${stats.changedDefaults}** default value change${stats.changedDefaults !== 1 ? 's' : ''} ⚠️`);
67
+ }
68
+
69
+ if (stats.changedTypes > 0) {
70
+ lines.push(`- **${stats.changedTypes}** type change${stats.changedTypes !== 1 ? 's' : ''} ⚠️`);
71
+ }
72
+
73
+ if (stats.changedDescriptions > 0) {
74
+ lines.push(`- **${stats.changedDescriptions}** description update${stats.changedDescriptions !== 1 ? 's' : ''}`);
75
+ }
76
+
77
+ if (stats.deprecatedProperties > 0) {
78
+ lines.push(`- **${stats.deprecatedProperties}** deprecated propert${stats.deprecatedProperties !== 1 ? 'ies' : 'y'}`);
79
+ }
80
+
81
+ if (stats.removedProperties > 0) {
82
+ lines.push(`- **${stats.removedProperties}** removed propert${stats.removedProperties !== 1 ? 'ies' : 'y'} ⚠️`);
83
+ }
84
+
85
+ if (stats.emptyDescriptions > 0) {
86
+ lines.push(`- **${stats.emptyDescriptions}** propert${stats.emptyDescriptions !== 1 ? 'ies' : 'y'} with missing descriptions ⚠️`);
87
+ }
88
+
89
+ lines.push('');
90
+
91
+ // Breaking Changes Section
92
+ const breakingChanges = [];
93
+ if (stats.removedProperties > 0) breakingChanges.push('removed properties');
94
+ if (stats.changedDefaults > 0) breakingChanges.push('changed defaults');
95
+ if (stats.changedTypes > 0) breakingChanges.push('changed types');
96
+
97
+ if (breakingChanges.length > 0) {
98
+ lines.push('### Warning: Breaking Changes Detected');
99
+ lines.push('');
100
+ lines.push(`This update includes **${breakingChanges.join(', ')}** that may affect existing configurations.`);
101
+ lines.push('');
102
+ }
103
+
104
+ // Missing Descriptions Warning
105
+ if (stats.emptyDescriptions > 0) {
106
+ lines.push('### Warning: Missing Descriptions');
107
+ lines.push('');
108
+ lines.push(`**${stats.emptyDescriptions}** propert${stats.emptyDescriptions !== 1 ? 'ies are' : 'y is'} missing descriptions - these need writer attention:`);
109
+ lines.push('');
110
+
111
+ diffData.details.emptyDescriptions.forEach(prop => {
112
+ lines.push(`- \`${prop.name}\` (${prop.type})`);
113
+ });
114
+ lines.push('');
115
+ }
116
+
117
+ // Action Items
118
+ lines.push('### 📝 Action Items for Writers');
119
+ lines.push('');
120
+
121
+ const actionItems = [];
122
+
123
+ // Add action items for missing descriptions
124
+ if (stats.emptyDescriptions > 0) {
125
+ actionItems.push({
126
+ priority: 0,
127
+ text: `Warning: Add descriptions for ${stats.emptyDescriptions} propert${stats.emptyDescriptions !== 1 ? 'ies' : 'y'} (see Missing Descriptions section)`
128
+ });
129
+ }
130
+
131
+ // New properties that need review
132
+ if (stats.newProperties > 0) {
133
+ const shortDescCount = diffData.details.newProperties.filter(p =>
134
+ !p.description || p.description.length < 50
135
+ ).length;
136
+
137
+ if (shortDescCount > 0) {
138
+ actionItems.push({
139
+ priority: 1,
140
+ text: `Review and enhance descriptions for ${shortDescCount} new propert${shortDescCount !== 1 ? 'ies' : 'y'} with minimal context`
141
+ });
142
+ }
143
+ }
144
+
145
+ // Deprecated properties
146
+ if (stats.deprecatedProperties > 0) {
147
+ diffData.details.deprecatedProperties.forEach(prop => {
148
+ actionItems.push({
149
+ priority: 2,
150
+ text: `Update docs for deprecated property \`${prop.name}\``
151
+ });
152
+ });
153
+ }
154
+
155
+ // Removed properties
156
+ if (stats.removedProperties > 0) {
157
+ actionItems.push({
158
+ priority: 3,
159
+ text: `Review removal of ${stats.removedProperties} propert${stats.removedProperties !== 1 ? 'ies' : 'y'} and update migration guides if needed`
160
+ });
161
+ }
162
+
163
+ // Changed defaults that may break configs
164
+ if (stats.changedDefaults > 0) {
165
+ actionItems.push({
166
+ priority: 4,
167
+ text: `Review ${stats.changedDefaults} default value change${stats.changedDefaults !== 1 ? 's' : ''} for breaking changes`
168
+ });
169
+ }
170
+
171
+ // Sort by priority and output
172
+ actionItems.sort((a, b) => a.priority - b.priority);
173
+
174
+ if (actionItems.length > 0) {
175
+ actionItems.forEach(item => {
176
+ lines.push(`- [ ] ${item.text}`);
177
+ });
178
+ } else {
179
+ lines.push('- [ ] Review generated documentation');
180
+ }
181
+
182
+ lines.push('');
183
+
184
+ // Detailed breakdown (expandable)
185
+ lines.push('<details>');
186
+ lines.push('<summary><strong>📋 Detailed Changes</strong> (click to expand)</summary>');
187
+ lines.push('');
188
+
189
+ // New Properties
190
+ if (stats.newProperties > 0) {
191
+ lines.push('#### New Properties');
192
+ lines.push('');
193
+ lines.push('| Property | Type | Default | Description |');
194
+ lines.push('|----------|------|---------|-------------|');
195
+
196
+ diffData.details.newProperties.forEach(prop => {
197
+ const name = `\`${prop.name}\``;
198
+ const type = prop.type || 'unknown';
199
+ const defaultVal = formatDefaultValue(prop.default);
200
+ const desc = truncateDescription(prop.description, 80);
201
+ lines.push(`| ${name} | ${type} | ${defaultVal} | ${desc} |`);
202
+ });
203
+ lines.push('');
204
+ }
205
+
206
+ // Changed Defaults
207
+ if (stats.changedDefaults > 0) {
208
+ lines.push('#### Warning: Changed Default Values');
209
+ lines.push('');
210
+ lines.push('| Property | Old Default | New Default |');
211
+ lines.push('|----------|-------------|-------------|');
212
+
213
+ diffData.details.changedDefaults.forEach(change => {
214
+ const name = `\`${change.name}\``;
215
+ const oldVal = formatDefaultValue(change.oldDefault);
216
+ const newVal = formatDefaultValue(change.newDefault);
217
+ lines.push(`| ${name} | ${oldVal} | ${newVal} |`);
218
+ });
219
+ lines.push('');
220
+ }
221
+
222
+ // Changed Types
223
+ if (stats.changedTypes > 0) {
224
+ lines.push('#### Warning: Changed Property Types');
225
+ lines.push('');
226
+ lines.push('| Property | Old Type | New Type |');
227
+ lines.push('|----------|----------|----------|');
228
+
229
+ diffData.details.changedTypes.forEach(change => {
230
+ const name = `\`${change.name}\``;
231
+ lines.push(`| ${name} | ${change.oldType} | ${change.newType} |`);
232
+ });
233
+ lines.push('');
234
+ }
235
+
236
+ // Changed Descriptions
237
+ if (stats.changedDescriptions > 0) {
238
+ lines.push('#### Description Updates');
239
+ lines.push('');
240
+ lines.push(`**${stats.changedDescriptions}** propert${stats.changedDescriptions !== 1 ? 'ies have' : 'y has'} updated descriptions:`);
241
+ lines.push('');
242
+
243
+ diffData.details.changedDescriptions.forEach(change => {
244
+ lines.push(`**\`${change.name}\`:**`);
245
+ lines.push('');
246
+ lines.push('Old:');
247
+ lines.push('> ' + (change.oldDescription || 'No description'));
248
+ lines.push('');
249
+ lines.push('New:');
250
+ lines.push('> ' + (change.newDescription || 'No description'));
251
+ lines.push('');
252
+ });
253
+ }
254
+
255
+ // Deprecated Properties
256
+ if (stats.deprecatedProperties > 0) {
257
+ lines.push('#### Deprecated Properties');
258
+ lines.push('');
259
+ diffData.details.deprecatedProperties.forEach(prop => {
260
+ lines.push(`- **\`${prop.name}\`** — ${prop.reason}`);
261
+ });
262
+ lines.push('');
263
+ }
264
+
265
+ // Removed Properties
266
+ if (stats.removedProperties > 0) {
267
+ lines.push('#### Warning: Removed Properties');
268
+ lines.push('');
269
+ diffData.details.removedProperties.forEach(prop => {
270
+ lines.push(`- **\`${prop.name}\`** (${prop.type})`);
271
+ if (prop.description && prop.description !== 'No description') {
272
+ lines.push(` - ${truncateDescription(prop.description, 100)}`);
273
+ }
274
+ });
275
+ lines.push('');
276
+ }
277
+
278
+ lines.push('</details>');
279
+ lines.push('');
280
+
281
+ // Footer
282
+ lines.push('---');
283
+ lines.push('');
284
+ lines.push(`*Generated: ${diffData.comparison.timestamp}*`);
285
+ lines.push('');
286
+ lines.push('<!-- PR_SUMMARY_END -->');
287
+
288
+ return lines.join('\n');
289
+ }
290
+
291
+ /**
292
+ * Format a default value for display in tables
293
+ * @param {*} value - The default value
294
+ * @returns {string} Formatted value
295
+ */
296
+ function formatDefaultValue(value) {
297
+ if (value === null || value === undefined) {
298
+ return '`null`';
299
+ }
300
+ if (typeof value === 'string') {
301
+ return `\`"${value}"\``;
302
+ }
303
+ if (typeof value === 'boolean') {
304
+ return `\`${value}\``;
305
+ }
306
+ if (typeof value === 'number') {
307
+ // Format large numbers with human-readable units
308
+ if (value >= 3600000) {
309
+ const hours = value / 3600000;
310
+ return `\`${value}\` (${hours}h)`;
311
+ }
312
+ if (value >= 60000) {
313
+ const minutes = value / 60000;
314
+ return `\`${value}\` (${minutes}m)`;
315
+ }
316
+ if (value >= 1000) {
317
+ const seconds = value / 1000;
318
+ return `\`${value}\` (${seconds}s)`;
319
+ }
320
+ return `\`${value}\``;
321
+ }
322
+ if (Array.isArray(value)) {
323
+ if (value.length === 0) return '`[]`';
324
+ return `\`[${value.length} items]\``;
325
+ }
326
+ if (typeof value === 'object') {
327
+ return `\`${JSON.stringify(value)}\``;
328
+ }
329
+ return `\`${String(value)}\``;
330
+ }
331
+
332
+ /**
333
+ * Truncate description to specified length, respecting word boundaries
334
+ * @param {string} text - Text to truncate
335
+ * @param {number} maxLength - Maximum length
336
+ * @returns {string} Truncated text
337
+ */
338
+ function truncateDescription(text, maxLength = 100) {
339
+ if (!text || text === 'No description') {
340
+ return '*No description*';
341
+ }
342
+
343
+ // Remove newlines and excessive whitespace
344
+ const clean = text.replace(/\s+/g, ' ').trim();
345
+
346
+ if (clean.length <= maxLength) {
347
+ return clean;
348
+ }
349
+
350
+ // Truncate at word boundary
351
+ const truncated = clean.substring(0, maxLength);
352
+ const lastSpace = truncated.lastIndexOf(' ');
353
+
354
+ if (lastSpace > maxLength * 0.8) {
355
+ return truncated.substring(0, lastSpace) + '...';
356
+ }
357
+
358
+ return truncated + '...';
359
+ }
360
+
361
+ /**
362
+ * Print the PR summary to console
363
+ * @param {object} diffData - Diff data
364
+ */
365
+ function printPRSummary(diffData) {
366
+ const summary = generatePRSummary(diffData);
367
+ console.log('\n' + summary + '\n');
368
+ }
369
+
370
+ module.exports = {
371
+ generatePRSummary,
372
+ printPRSummary,
373
+ formatDefaultValue,
374
+ truncateDescription
375
+ };