Skip to content

Extend update-docs: verify and update relative links in the documentation - #153

Merged
bubacoder merged 4 commits into
mainfrom
feature/docs-site
Jul 19, 2025
Merged

Extend update-docs: verify and update relative links in the documentation#153
bubacoder merged 4 commits into
mainfrom
feature/docs-site

Conversation

@bubacoder

@bubacoder bubacoder commented Jul 18, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Documentation
    • Updated a documentation link to point to a more specific resource about open-source language models.
    • Added a new YAML configuration file to organize and map documentation content for the website.
  • Chores
    • Updated Dockerfile base images to newer versions for improved compatibility and security.
    • Introduced a new task to collect markdown and YAML files for the documentation site, and clarified the export task’s description and behavior.
  • Refactor
    • Reorganized the documentation processing script for better maintainability, added structured logging, improved error handling, and enhanced link validation and rewriting.

@coderabbitai

coderabbitai Bot commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This update refactors the documentation processing script into a class-based design, introduces YAML-driven configuration for markdown file mapping, and enhances link validation and rewriting. It also updates Dockerfile base images, adds a new content collection task, and introduces a configuration file for documentation structure. Minor documentation link corrections are included.

Changes

File(s) Change Summary
docs/web/update-docs.py Refactored to use a DocsProcessor class, YAML-driven config, structured logging, improved link handling, and removed global state.
docs/web/update-docs-config.yaml Added new YAML config mapping markdown sources to site structure with weights for ordering.
docs/web/Taskfile.web.yaml Added collect task for extracting content; updated export task description and behavior.
docs/web/Dockerfile Updated all base images to newer versions in each build stage.
docs/ai/README.md Updated a documentation link to reference "open-models.md" instead of "models.md".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DocsProcessor
    participant YAML Config
    participant FileSystem

    User->>DocsProcessor: Run script with repository and output paths
    DocsProcessor->>YAML Config: Load update-docs-config.yaml
    YAML Config-->>DocsProcessor: Return mapping config
    loop For each mapping in config
        DocsProcessor->>FileSystem: Read source markdown file(s)
        DocsProcessor->>DocsProcessor: Process links and content
        DocsProcessor->>FileSystem: Write processed file to output path
    end
    DocsProcessor-->>User: Processing complete (with logs)
Loading

Possibly related PRs

  • Add new AI models, update docs #137: Updates documentation links to point to the expanded "open-models.md" file, which directly relates to the documentation link change in this PR.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a805a8 and e7c2e6d.

📒 Files selected for processing (2)
  • docs/web/update-docs-config.yaml (1 hunks)
  • docs/web/update-docs.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/web/update-docs-config.yaml
⏰ 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). (2)
  • GitHub Check: build
  • GitHub Check: check
🔇 Additional comments (6)
docs/web/update-docs.py (6)

14-43: Excellent class-based refactor with proper initialization.

The transition from procedural to object-oriented design is well-executed. The constructor properly initializes logging with configurable verbosity levels and loads configuration from YAML, making the script much more maintainable and flexible.


59-96: Robust link extraction and validation implementation.

The regex pattern correctly identifies markdown links while properly filtering out absolute URLs, anchors, and mailto links. The validation logic appropriately resolves relative paths and handles edge cases like empty link paths.


97-162: Well-implemented link updating with comprehensive mapping logic.

The method properly handles anchor preservation, directory vs. file mappings, and relative path calculations. The warning for unmappable links provides useful feedback for broken or missing documentation links.


163-188: Effective markdown content processing with proper link handling.

The method correctly integrates link validation and updating, with appropriate use of re.escape to handle special characters in URLs. The broken link warnings provide valuable feedback during documentation processing.


252-353: Comprehensive Docker processing with good metadata extraction.

The Docker processing methods effectively handle stack indices and compose files, with intelligent metadata extraction from homepage labels. The YAML-to-markdown conversion with proper frontmatter generation is well-implemented.


354-398: Well-structured main processing workflow and script entry point.

The processing workflow logically sequences directory cleanup, Docker processing, and markdown location processing. The command-line interface is preserved and properly integrated with the new class-based design.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/docs-site

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (4)
docs/web/Taskfile.web.yaml (1)

17-17: Consider removing --no-cache flag for better performance

The --no-cache flag forces Docker to rebuild all layers, which significantly slows down builds. Remove it unless you specifically need to bypass the cache.

-        docker build -f docs/web/Dockerfile -t "${TAG}" --target collect --progress=plain --no-cache .
+        docker build -f docs/web/Dockerfile -t "${TAG}" --target collect --progress=plain .
docs/web/update-docs.py (2)

293-293: Replace print with logger for consistency

Use the logger for error messages instead of print.

         except yaml.YAMLError as ex:
-            print(ex)
+            self.logger.error(f"YAML parsing error: {ex}")
             return {}

360-365: Consider using logger for processing status messages

For consistency, consider using the logger for status messages instead of print statements.

-        print("Processing Docker Compose stacks")
+        self.logger.info("Processing Docker Compose stacks")
         self.process_docker_directory("docker", "docker")

         for source, target, weight in self.markdown_locations:
-            print(f"Processing {source} ==> {target}")
+            self.logger.info(f"Processing {source} ==> {target}")
             self.process_location(source, target, weight)
docs/web/update-docs-config.yaml (1)

4-6: Prefer key-based objects over positional tuples for long-term maintainability

Using 3-element arrays forces every consumer (and every future reader) to remember that index 0 = source, 1 = target, 2 = weight. A dictionary-style layout is self-describing and less error-prone.

Example rewrite:

-locations:
-  - ["README.md", "_index.md", 0]
+locations:
+  - source: "README.md"
+    target: "_index.md"
+    weight: 0

Consider switching before this file gains more entries.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b4cace and 5a805a8.

📒 Files selected for processing (5)
  • docs/ai/README.md (1 hunks)
  • docs/web/Dockerfile (3 hunks)
  • docs/web/Taskfile.web.yaml (2 hunks)
  • docs/web/update-docs-config.yaml (1 hunks)
  • docs/web/update-docs.py (3 hunks)
🔇 Additional comments (8)
docs/web/Dockerfile (1)

16-16: Ensure compatibility with Hugo v0.148.1 upgrade

You’ve bumped Hugo from 0.136.5→0.148.1 in docs/web/Dockerfile (lines 16 and 38). Before merging, please verify your site’s code and configuration against the breaking changes introduced between 0.136 and 0.148:

  • Migrate the deprecated .Site.Author field to [params.author] in your site config
  • Replace any .File.Path checks with .RelPermalink
  • Audit taxonomy/front-matter options: menuTitlelinkTitle, move description to page front matter
  • Swap out removed shortcodes (e.g. swaggeropenapi)
  • Update any template references to .Err in resource pipelines to use Hugo’s try function
  • Review possible Markdown rendering differences (Blackfriday→Goldmark)
  • Confirm all third-party themes and custom shortcodes are updated for Hugo v0.148

• Test the site locally against v0.148.1 and consult the Hugo release notes for detailed migration guidance.

docs/ai/README.md (1)

27-27: Confirmed: docs/ai/open-models.md link is valid and no legacy file remains

  • docs/ai/open-models.md was found in the same directory.
  • No docs/ai/models.md file exists, so there’s nothing to clean up.
docs/web/Taskfile.web.yaml (1)

9-23: New collect task looks good

The task properly extracts markdown and YAML content from the Docker build's collect stage.

docs/web/update-docs.py (3)

14-55: Well-structured class-based refactoring

The refactoring to use a DocsProcessor class with proper initialization, logging setup, and configuration loading is a significant improvement over the previous procedural approach.


67-79: Link extraction regex looks comprehensive

The regex pattern correctly identifies markdown links and filters out absolute URLs, anchors, and mailto links.


98-163: Robust link updating logic

The link updating function properly handles:

  • Anchor preservation
  • Directory vs file targets
  • Relative path calculations
  • Missing targets with appropriate warnings
docs/web/update-docs-config.yaml (2)

13-14: Duplicate weight values may lead to unstable menu ordering

Both ansible/README.md and terraform/README.md use weight: 0, as does the root README.md.
If your site generator relies on unique weights to sort siblings, the final order can vary between builds.

Confirm whether duplicates are intentional; if not, assign distinct weights or rely on natural file order.


8-18: Configuration format confirmed

Ran the suggested smoke test against docs/web/update-docs-config.yaml and verified every entry in locations is a 3-element list. No changes required.

Comment thread docs/web/Dockerfile
Comment thread docs/web/Taskfile.web.yaml
Comment thread docs/web/update-docs.py
Comment thread docs/web/update-docs.py Outdated
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.

1 participant