@redpanda-data/docs-extensions-and-macros 5.51.2 → 5.52.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.
Files changed (33) hide show
  1. package/bin/doc-tools-mcp.js +4 -0
  2. package/bin/doc-tools.js +1 -0
  3. package/bin/mcp-tools/rpcn-docs.js +1 -0
  4. package/extensions/REFERENCE.adoc +19 -4
  5. package/extensions/generate-rp-connect-categories.js +76 -25
  6. package/extensions/generate-rp-connect-info.js +150 -40
  7. package/extensions/modify-connect-tag-playbook.js +183 -17
  8. package/extensions/util/connect-catalog.js +153 -0
  9. package/macros/rp-connect-components.js +23 -8
  10. package/package.json +1 -1
  11. package/tools/lint-strings/diff.js +4 -1
  12. package/tools/lint-strings/engine.js +5 -0
  13. package/tools/lint-strings/fixtures/connect/lint_connect.go +1 -1
  14. package/tools/lint-strings/fixtures/connect/repo/go.mod.txt +5 -0
  15. package/tools/lint-strings/fixtures/connect/repo/internal/cli/lint.go +19 -0
  16. package/tools/lint-strings/fixtures/connect/repo/internal/impl/azure/common.go +20 -0
  17. package/tools/lint-strings/fixtures/connect/repo/internal/impl/azure/docs.go +8 -0
  18. package/tools/lint-strings/fixtures/connect/repo/internal/impl/azure/input_thing.go +32 -0
  19. package/tools/lint-strings/fixtures/connect/repo/internal/impl/azure/output_thing.go +12 -0
  20. package/tools/lint-strings/fixtures/connect/repo/internal/impl/widget/bloblang.go +21 -0
  21. package/tools/lint-strings/fixtures/connect/repo/internal/impl/widget/scanner.go +12 -0
  22. package/tools/lint-strings/fixtures/connect/repo/internal/plugins/info.csv +3 -0
  23. package/tools/lint-strings/fixtures/connect/repo/internal/retries/retries.go +13 -0
  24. package/tools/lint-strings/go-index.js +1143 -0
  25. package/tools/lint-strings/index.js +28 -2
  26. package/tools/lint-strings/rules/common.js +10 -2
  27. package/tools/lint-strings/surfaces/connect.js +1484 -137
  28. package/tools/lint-strings/surfaces/rpk.js +1 -0
  29. package/tools/redpanda-connect/generate-rpcn-connector-docs.js +23 -13
  30. package/tools/redpanda-connect/report-delta.js +1 -0
  31. package/tools/redpanda-connect/rpcn-connector-docs-handler.js +19 -13
  32. package/tools/redpanda-connect/templates/connector.hbs +20 -2
  33. package/tools/rpk-docs/helpers/index.js +32 -35
@@ -94,6 +94,8 @@ function lintStrings (options) {
94
94
  const pending = []
95
95
  let alreadyReviewed = 0
96
96
  let removal = { rawFiles: [], declarations: [] }
97
+ const skipped = []
98
+ let unverifiable = 0
97
99
 
98
100
  if (diffBase) {
99
101
  const { changed, removed } = getDiffLines(repoPath, diffBase)
@@ -137,9 +139,18 @@ function lintStrings (options) {
137
139
  continue
138
140
  }
139
141
  declarations.push(decl)
140
- pending.push({ ...pendingEntry(decl), context: pageContext(decl, everything || head) })
142
+ if (decl.meta && decl.meta.unverifiable) unverifiable++
143
+ const detail = surface.reviewContext ? surface.reviewContext(decl) : null
144
+ pending.push({ ...pendingEntry(decl), ...(detail ? { detail } : {}), context: pageContext(decl, everything || head) })
141
145
  }
142
146
  results.push(runRules(declarations, rulesFor(surface), { skipRules, onlyRules }))
147
+ // Doc-method calls the extractor saw but could not trace, in the
148
+ // lines this diff changed. Reported so a gap is never silent.
149
+ const skippedHere = (everything ? everything.skipped : head.skipped) || []
150
+ for (const entry of skippedHere) {
151
+ const lines = files.get(entry.file)
152
+ if (lines && lines.has(entry.line)) skipped.push(entry)
153
+ }
143
154
  }
144
155
 
145
156
  removal = collectRemovals({ repoPath, diffBase, removed: removedBySurface, surfaces, requested, headBySurface, log })
@@ -151,7 +162,11 @@ function lintStrings (options) {
151
162
  const surface = SURFACES[surfaceName]
152
163
  log(`[${surfaceName}] extracting declarations from ${repoPath}...`)
153
164
  const declarations = surface.extract({ repo: repoPath, log })
154
- for (const decl of declarations) decl.in_pr_diff = false
165
+ for (const decl of declarations) {
166
+ decl.in_pr_diff = false
167
+ if (decl.meta && decl.meta.unverifiable) unverifiable++
168
+ }
169
+ skipped.push(...(declarations.skipped || []))
155
170
  results.push(runRules(declarations, rulesFor(surface), { skipRules, onlyRules }))
156
171
  }
157
172
  }
@@ -168,6 +183,11 @@ function lintStrings (options) {
168
183
  merged.summary.alreadyReviewed = alreadyReviewed
169
184
  }
170
185
  merged.summary.removedDeclarations = removal.declarations.map(pendingEntry)
186
+ // Declarations whose text has gaps the extractor could not evaluate
187
+ // (rules that judge exact text skip them), and doc-method calls it could
188
+ // not attribute at all. Both are counted so a gap is never silent.
189
+ merged.summary.unverifiableDeclarations = unverifiable
190
+ merged.summary.skippedDeclarations = skipped
171
191
  const removedSurfaceFiles = [...removal.rawFiles, ...removedFilesFor(removal.declarations)]
172
192
  .sort((a, b) => a.surface.localeCompare(b.surface) || a.file.localeCompare(b.file))
173
193
  merged.summary.removedSurfaceFiles = removedSurfaceFiles
@@ -455,6 +475,12 @@ function formatHuman (result) {
455
475
  lines.push(`Lines deleted from doc-string surfaces: ${summary.removedSurfaceLines} ` +
456
476
  `(${summary.removedSurfaceFiles.length} file(s) with no extractor, so every deleted line counts)`)
457
477
  }
478
+ if (summary.unverifiableDeclarations) {
479
+ lines.push(`Declarations with text the extractor could not fully evaluate: ${summary.unverifiableDeclarations} (exact-text rules skipped)`)
480
+ }
481
+ for (const entry of summary.skippedDeclarations || []) {
482
+ lines.push(`Not extracted: ${entry.file}:${entry.line} .${entry.method}() (${entry.surface}): ${entry.reason}`)
483
+ }
458
484
  lines.push(`Errors: ${summary.errors} Warnings: ${summary.warnings} Info: ${summary.info}`)
459
485
  if (Object.keys(summary.byRule).length > 0) {
460
486
  lines.push('\nBy rule:')
@@ -59,8 +59,9 @@ function isNameEcho (name, description) {
59
59
  * appear bare, so the inline-code rule only sees prose:
60
60
  *
61
61
  * * backticked spans - already marked up, which is the whole point;
62
- * * URLs and Markdown link targets - a path inside a link is part of the
63
- * link, and backticking it would break the link;
62
+ * * URLs, Markdown link targets, and AsciiDoc macro targets and anchor
63
+ * ids - a path inside a link is part of the link, and backticking it
64
+ * would break the link;
64
65
  * * anything the declaration is named after, which name-echo owns.
65
66
  *
66
67
  * Replaced with spaces rather than removed so match indices stay meaningful.
@@ -74,6 +75,13 @@ function maskNonProse (text) {
74
75
  out = out.replace(/\[[^\]]*\]\([^)]*\)/g, blank)
75
76
  // Bare URLs, and AsciiDoc's url[text] form.
76
77
  out = out.replace(/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi, blank)
78
+ // AsciiDoc macro targets and anchor ids: xref:components:processors/
79
+ // schema_registry_encode.adoc[...] names a page, <<avro_raw_json,...>>
80
+ // and [[field_paths]] name an anchor. Backticking either breaks the link.
81
+ // The label in brackets stays prose.
82
+ out = out.replace(/\b(?:xref|link|image|include|glossterm|config_ref|anchor):[^\s[]*(?=\[)/g, blank)
83
+ out = out.replace(/<<[^,>]*/g, blank)
84
+ out = out.replace(/\[\[[^\]]*\]\]|\[#[^\]]*\]/g, blank)
77
85
  return out
78
86
  }
79
87