@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
@@ -9,6 +9,43 @@ component_type_dropdown::[]
9
9
 
10
10
  {{> intro}}
11
11
 
12
+ {{#if (or this.config.children children)}}
13
+ [tabs]
14
+ ======
15
+ Common::
16
+ +
17
+ --
18
+
19
+ ```yml
20
+ include::components:example$common/{{type}}s/{{name}}.yaml[]
21
+ ```
22
+
23
+ --
24
+ Advanced::
25
+ +
26
+ --
27
+
28
+ ```yml
29
+ include::components:example$advanced/{{type}}s/{{name}}.yaml[]
30
+ ```
31
+
32
+ --
33
+ ======
34
+ {{/if}}
35
+
36
+ {{#if requiresCgo}}
37
+ == Requirements
38
+
39
+ Ensure that your environment meets the following requirements:
40
+
41
+ - This component is only available in cgo-enabled builds of Redpanda Connect (not in the Redpanda CLI or Docker image).
42
+ +
43
+ You can either xref:install:prebuilt-binary.adoc[download a prebuilt cgo-enabled binary] or xref:install:build-from-source.adoc[build Redpanda Connect from source with cgo enabled].
44
+ {{#if requiresIdempotency}}
45
+ - Consumers must implement idempotency when processing messages to handle potential duplicates.
46
+ {{/if}}
47
+
48
+ {{/if}}
12
49
  {{#if (or this.config.children children)}}
13
50
  include::redpanda-connect:components:partial$fields/{{type}}s/{{name}}.adoc[]
14
51
  {{/if}}
@@ -17,4 +54,5 @@ include::redpanda-connect:components:partial$fields/{{type}}s/{{name}}.adoc[]
17
54
  include::redpanda-connect:components:partial$examples/{{type}}s/{{name}}.adoc[]
18
55
  {{/if}}
19
56
 
57
+
20
58
  // end::single-source[]
@@ -6,26 +6,6 @@ Introduced in version {{version}}.
6
6
  endif::[]
7
7
  {{/if}}
8
8
 
9
- {{#if this.config.children}}
10
- [tabs]
11
- ======
12
- Common::
13
- +
14
- --
15
- ```yaml
16
- {{{commonConfig this.type this.name this.config.children}}}
17
- ```
18
- --
19
- Advanced::
20
- +
21
- --
22
- ```yaml
23
- {{{advancedConfig this.type this.name this.config.children}}}
24
- ```
25
- --
26
- ======
27
- {{/if}}
28
-
29
9
  {{#if description}}
30
10
  {{{description}}}
31
11
  {{else}}
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Updates modules/ROOT/nav.adoc with new connector entries
3
+ */
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+
8
+ /**
9
+ * Parse nav.adoc and extract connector sections
10
+ * @param {string} content - nav.adoc content
11
+ * @returns {Object} Sections with their connectors
12
+ */
13
+ function parseNav(content) {
14
+ const lines = content.split('\n');
15
+ const sections = {};
16
+ let currentSection = null;
17
+ let sectionStartLine = -1;
18
+ let sectionEndLine = -1;
19
+
20
+ for (let i = 0; i < lines.length; i++) {
21
+ const line = lines[i];
22
+
23
+ // Detect component type sections
24
+ if (line.match(/^\*\* xref:components:(inputs|outputs|processors|scanners|caches|rate_limits|buffers|metrics|tracers)\/about\.adoc\[\]/)) {
25
+ // Save previous section end
26
+ if (currentSection && sectionStartLine !== -1) {
27
+ sections[currentSection].endLine = i - 1;
28
+ }
29
+
30
+ // Extract type
31
+ const match = line.match(/components:(\w+)\//);
32
+ currentSection = match ? match[1] : null;
33
+
34
+ if (currentSection) {
35
+ sections[currentSection] = {
36
+ startLine: i,
37
+ endLine: -1,
38
+ connectors: []
39
+ };
40
+ sectionStartLine = i;
41
+ }
42
+ }
43
+
44
+ // Collect connector entries
45
+ if (currentSection && line.match(/^\*\*\* xref:components:\w+\/[\w_]+\.adoc\[\]/)) {
46
+ const match = line.match(/xref:components:\w+\/([\w_]+)\.adoc/);
47
+ if (match) {
48
+ sections[currentSection].connectors.push({
49
+ name: match[1],
50
+ line: i,
51
+ text: line
52
+ });
53
+ }
54
+ }
55
+
56
+ // Detect section end (next major section starts)
57
+ if (currentSection && line.match(/^\*\* xref:/) && !line.includes(`components:${currentSection}`)) {
58
+ sections[currentSection].endLine = i - 1;
59
+ currentSection = null;
60
+ }
61
+ }
62
+
63
+ // Close last section if needed
64
+ if (currentSection && sections[currentSection].endLine === -1) {
65
+ sections[currentSection].endLine = lines.length - 1;
66
+ }
67
+
68
+ return { lines, sections };
69
+ }
70
+
71
+ /**
72
+ * Insert connectors into nav.adoc in alphabetical order
73
+ * @param {string} navPath - Path to nav.adoc
74
+ * @param {Array} newConnectors - Array of {type, name} objects
75
+ * @returns {Object} Update result
76
+ */
77
+ function updateNav(navPath, newConnectors) {
78
+ if (!fs.existsSync(navPath)) {
79
+ throw new Error(`nav.adoc not found at ${navPath}`);
80
+ }
81
+
82
+ const content = fs.readFileSync(navPath, 'utf8');
83
+ const { lines, sections } = parseNav(content);
84
+
85
+ const updates = [];
86
+ const skipped = [];
87
+
88
+ // Group new connectors by type
89
+ const byType = {};
90
+ newConnectors.forEach(conn => {
91
+ if (!byType[conn.type]) byType[conn.type] = [];
92
+ byType[conn.type].push(conn);
93
+ });
94
+
95
+ // Process each type
96
+ Object.entries(byType).forEach(([type, connectors]) => {
97
+ if (!sections[type]) {
98
+ console.warn(`Warning: Section not found for type: ${type}`);
99
+ connectors.forEach(c => skipped.push({ ...c, reason: 'section not found' }));
100
+ return;
101
+ }
102
+
103
+ const section = sections[type];
104
+ const existingNames = new Set(section.connectors.map(c => c.name));
105
+
106
+ connectors.forEach(conn => {
107
+ // Skip if already exists
108
+ if (existingNames.has(conn.name)) {
109
+ skipped.push({ ...conn, reason: 'already exists' });
110
+ return;
111
+ }
112
+
113
+ // Find insertion point (alphabetical order)
114
+ const newEntry = `*** xref:components:${type}/${conn.name}.adoc[]`;
115
+ let insertIndex = -1;
116
+
117
+ for (let i = 0; i < section.connectors.length; i++) {
118
+ if (conn.name.localeCompare(section.connectors[i].name) < 0) {
119
+ insertIndex = section.connectors[i].line;
120
+ break;
121
+ }
122
+ }
123
+
124
+ // If no insertion point found, append at end of section
125
+ if (insertIndex === -1) {
126
+ // Find last connector line in section
127
+ if (section.connectors.length > 0) {
128
+ insertIndex = section.connectors[section.connectors.length - 1].line + 1;
129
+ } else {
130
+ // Empty section, insert after section header
131
+ insertIndex = section.startLine + 1;
132
+ }
133
+ }
134
+
135
+ updates.push({
136
+ type,
137
+ name: conn.name,
138
+ insertIndex,
139
+ entry: newEntry
140
+ });
141
+ });
142
+ });
143
+
144
+ // Apply updates (in reverse order to maintain line numbers)
145
+ updates.sort((a, b) => b.insertIndex - a.insertIndex);
146
+
147
+ updates.forEach(update => {
148
+ lines.splice(update.insertIndex, 0, update.entry);
149
+ });
150
+
151
+ // Write updated nav.adoc
152
+ fs.writeFileSync(navPath, lines.join('\n'));
153
+
154
+ return {
155
+ updated: updates.length,
156
+ skippedCount: skipped.length,
157
+ updates,
158
+ skipped
159
+ };
160
+ }
161
+
162
+ /**
163
+ * Update nav.adoc from draft files
164
+ * @param {Array} draftFiles - Array of draft file objects
165
+ * @param {string} navPath - Path to nav.adoc (optional, auto-detects)
166
+ * @returns {Object} Update result
167
+ */
168
+ function updateNavFromDrafts(draftFiles, navPath = null) {
169
+ // Auto-detect nav.adoc location if not provided
170
+ if (!navPath) {
171
+ const possiblePaths = [
172
+ path.resolve(process.cwd(), 'modules/ROOT/nav.adoc'),
173
+ path.resolve(process.cwd(), '../rp-connect-docs/modules/ROOT/nav.adoc'),
174
+ // Optional: Set RP_CONNECT_DOCS_PATH env var to specify custom location
175
+ process.env.RP_CONNECT_DOCS_PATH && path.resolve(process.env.RP_CONNECT_DOCS_PATH, 'modules/ROOT/nav.adoc')
176
+ ].filter(Boolean);
177
+
178
+ for (const p of possiblePaths) {
179
+ if (fs.existsSync(p)) {
180
+ navPath = p;
181
+ break;
182
+ }
183
+ }
184
+
185
+ if (!navPath) {
186
+ console.warn('Warning: Could not find nav.adoc, skipping navigation update');
187
+ return { updated: 0, skippedCount: draftFiles.length, error: 'nav.adoc not found' };
188
+ }
189
+ }
190
+
191
+ console.log(`📝 Updating navigation: ${navPath}`);
192
+
193
+ const connectors = draftFiles.map(draft => ({
194
+ type: draft.type,
195
+ name: draft.name
196
+ }));
197
+
198
+ return updateNav(navPath, connectors);
199
+ }
200
+
201
+ module.exports = {
202
+ parseNav,
203
+ updateNav,
204
+ updateNavFromDrafts
205
+ };