Skip to content

Conversation

@JakeSCahill
Copy link
Contributor

@JakeSCahill JakeSCahill commented Oct 27, 2025

Enhanced the property-docs CLI workflow:

  • If --diff is not provided, the tool now automatically uses the latest Antora tag for diffing, streamlining version comparisons.
  • After generating docs, the Antora config is updated to reflect the new tag, ensuring documentation stays in sync with releases.
  • Added logic to skip diff and config updates when --diff and --tag are the same, preventing redundant operations and unnecessary file changes.
  • Added support for both .yml and .yaml Antora config files.

@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for docs-extensions-and-macros ready!

Name Link
🔨 Latest commit 85266c3
🔍 Latest deploy log https://app.netlify.com/projects/docs-extensions-and-macros/deploys/69008f6fd76f4100083fa82a
😎 Deploy Preview https://deploy-preview-145--docs-extensions-and-macros.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This pull request consolidates utility functions and enhances the documentation build automation. The getPrereleaseFromAntora() function is relocated from a dedicated module (cli-utils/beta-from-antora.js) to cli-utils/antora-utils.js, which now supports both antora.yml and antora.yaml file formats. The bin/doc-tools.js script is significantly refactored to introduce Antora-based configuration automation, including a new internal make() function for building property documentation with enriched environment variables and conditional diff generation based on tag comparison. Import paths in dependent tools are updated accordingly, and the package version is bumped to 4.10.7.

Sequence Diagram

sequenceDiagram
    participant CLI as bin/doc-tools.js
    participant Antora as Antora Config
    participant Make as make(tag)
    participant Report as Property Report

    CLI->>Antora: Read latest-redpanda-tag (if --diff not provided)
    Antora-->>CLI: oldTag or undefined
    
    alt oldTag exists and differs from newTag
        CLI->>Make: make(oldTag, ...)
        Make-->>CLI: oldTag built
        CLI->>Make: make(newTag, ...)
        Make-->>CLI: newTag built
        CLI->>Report: generatePropertyComparisonReport(oldTag, newTag)
        Report-->>CLI: Comparison complete
        CLI->>Antora: Update latest-redpanda-tag to newTag
    else oldTag == newTag or oldTag missing
        CLI->>Make: make(newTag, ...)
        Make-->>CLI: newTag built
        CLI->>CLI: Skip diff generation
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • bin/doc-tools.js: Complex conditional logic for diff handling, new make() function with environment variable management, and Antora configuration updates require careful verification of control flow and side effects.
  • cli-utils/antora-utils.js: New getPrereleaseFromAntora() function and dual-format file detection logic need validation for error handling and file selection priority.
  • File consolidation: Ensure all import path changes across multiple tools (tools/get-console-version.js, tools/get-redpanda-version.js) correctly reference the new location and that no callers are missed.

Possibly related PRs

  • Add support for saving properties to partials #140: Adds GENERATE_PARTIALS and OUTPUT_PARTIALS_DIR environment variable wiring in bin/doc-tools.js to the make() function invocation, extending the same build configuration infrastructure.
  • doc-tools link-readme CLI command #101: Introduced the original beta-from-antora.js module with getPrereleaseFromAntora(); this PR consolidates that functionality into antora-utils.js and removes the standalone file.

Suggested reviewers

  • kbatuigas
  • Feediver1
  • paulohtb6

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Use Antora config to determine current version" is directly aligned with the core purpose of the changeset. The modifications centrally involve refactoring the getPrereleaseFromAntora() function into cli-utils/antora-utils.js, enhancing bin/doc-tools.js to automatically source the oldTag from Antora attributes when --diff is not provided, and adding support for both .yml and .yaml config files. The title is concise and specific enough that a reviewer scanning the history would understand the primary objective involves leveraging Antora configuration for version determination. While the title doesn't enumerate all implementation details (such as the diff automation or config update mechanics), it appropriately captures the main theme without unnecessary noise.
Description Check ✅ Passed The pull request description is clearly related to the changeset and accurately reflects the actual modifications. Each of the four bullet points maps to substantive changes: automatically using the latest Antora tag for diffing corresponds to the workflow in bin/doc-tools.js; updating the Antora config after generating docs aligns with the config update logic; skipping redundant operations when --diff and --tag match is implemented in the control flow; and support for both .yml and .yaml files is added in cli-utils/antora-utils.js. The description provides meaningful context about the enhancements without being vague or off-topic.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JakeSCahill JakeSCahill requested a review from paulohtb6 October 27, 2025 14:34
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
bin/doc-tools.js (1)

1091-1133: Consider clarifying the tempDir parameter usage.

The make() function is well-structured, but the tempDir parameter is always passed as null in the current implementation (lines 1145, 1147). Since both builds write to the same outputDir with tag-prefixed filenames (which prevents collisions), this works correctly.

However, the parameter suggests a use case (writing to temporary directories) that isn't currently utilized. Consider either:

  1. Documenting why tempDir is designed this way (for future extensibility)
  2. Or simplifying by removing the parameter if it's not needed

If keeping the parameter for future use, add a JSDoc comment explaining when tempDir should be used versus null:

+/**
+ * Build property documentation for a specific tag.
+ * @param {string} tag - Git tag to extract from
+ * @param {string} overrides - Path to overrides file
+ * @param {object} templates - Template file paths
+ * @param {string} outDir - Output directory for final files
+ * @param {string|null} tempDir - Optional temp directory for intermediate builds (null to use outDir)
+ */
 const make = (tag, overrides, templates = {}, outDir = 'modules/reference/', tempDir = null) => {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 72f96e4 and 349d1ae.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • bin/doc-tools.js (3 hunks)
  • cli-utils/antora-utils.js (5 hunks)
  • cli-utils/beta-from-antora.js (0 hunks)
  • package.json (1 hunks)
  • tools/get-console-version.js (1 hunks)
  • tools/get-redpanda-version.js (1 hunks)
💤 Files with no reviewable changes (1)
  • cli-utils/beta-from-antora.js
🧰 Additional context used
🧬 Code graph analysis (2)
tools/get-console-version.js (2)
bin/doc-tools.js (11)
  • require (3-3)
  • require (5-5)
  • require (8-8)
  • require (10-10)
  • require (11-11)
  • require (13-13)
  • require (14-17)
  • require (851-851)
  • require (1363-1363)
  • require (1575-1575)
  • require (1582-1582)
tools/get-redpanda-version.js (1)
  • require (4-4)
tools/get-redpanda-version.js (2)
bin/doc-tools.js (11)
  • require (3-3)
  • require (5-5)
  • require (8-8)
  • require (10-10)
  • require (11-11)
  • require (13-13)
  • require (14-17)
  • require (851-851)
  • require (1363-1363)
  • require (1575-1575)
  • require (1582-1582)
tools/get-console-version.js (1)
  • require (7-7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - docs-extensions-and-macros
  • GitHub Check: Header rules - docs-extensions-and-macros
  • GitHub Check: Pages changed - docs-extensions-and-macros
🔇 Additional comments (11)
package.json (1)

3-3: LGTM!

The version bump from 4.10.6 to 4.10.7 is appropriate for the feature enhancements introduced in this PR.

cli-utils/antora-utils.js (4)

13-25: LGTM: Clean support for both .yml and .yaml extensions.

The implementation correctly prioritizes antora.yml over antora.yaml and gracefully handles the case where neither file exists.


85-137: LGTM: Consistent file detection logic.

The setAntoraValue() function follows the same pattern as loadAntoraConfig(), ensuring consistency across the module.


139-167: LGTM: Function correctly migrated with dual extension support.

The getPrereleaseFromAntora() function follows the same file detection pattern as other functions in this module and safely returns false on errors or when the file is missing. The strict equality check (prerelease === true) ensures only explicit boolean true values are treated as prerelease.


169-174: LGTM: Export list updated correctly.

The getPrereleaseFromAntora function is properly exported alongside existing utilities.

tools/get-console-version.js (1)

7-7: LGTM: Import path correctly updated.

The import path change aligns with the consolidation of utility functions into antora-utils.js.

tools/get-redpanda-version.js (1)

4-4: LGTM: Import path correctly updated.

Consistent with the refactoring in get-console-version.js, this import now points to the consolidated antora-utils.js module.

bin/doc-tools.js (4)

1032-1037: LGTM: Improved command description.

The updated description clearly communicates the default behavior (JSON extraction only) and the optional partial generation, which helps users understand the command's capabilities.


1143-1152: LGTM: Build sequence logic is correct.

The conditional build logic properly handles all scenarios:

  • Builds oldTag only when it exists and differs from newTag
  • Always builds newTag (the primary target)
  • Generates comparison report only when both tags exist and differ
  • Logs and skips redundant operations when tags are identical

1154-1158: LGTM: Antora update logic correctly implements auto-update behavior.

The conditional update (!options.diff && !tagsAreSame) ensures that:

  1. Manual diffs (when user provides --diff) don't trigger auto-updates
  2. The config is only updated when there's actually a new tag to record
  3. The update only happens after successful builds (since make() exits on failure)

This aligns with the PR objective to keep documentation in sync with releases.


1082-1089: The Antora attribute path is correctly implemented and used consistently.

The verification confirms that 'asciidoc.attributes.latest-redpanda-tag' is properly accessed across the codebase. The getAntoraValue and setAntoraValue functions correctly handle the nested dot-path access, reading from and writing to the antora.yml/antora.yaml file at the expected structure. The attribute is consistently referenced in set-latest-version.js, replace-attributes-in-attachments.js, and doc-tools.js with no discrepancies.

@JakeSCahill JakeSCahill merged commit 8b136fb into main Oct 28, 2025
17 checks passed
@JakeSCahill JakeSCahill deleted the update-antora branch October 28, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants