Skip to content

Conversation

maximmaxim345
Copy link

Description:

With the docs conversion to markdown/hugo, the devcontainer didn't work anymore.
This PR solves that by:

  • Installing npm (used by Makefile for pagefind)
  • Installing hugo
  • And installing the markdownlint vscode extension by default

Additionally pre-commit hooks are now installed by default.

Related issue (if applicable): fixes

Pull request in esphome with YAML changes (if applicable):

  • esphome/esphome#

Checklist:

  • I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • I am merging into current because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.

  • Link added in /components/index.rst when creating new documents for new components or cookbook.

New Component Images

If you are adding a new component to ESPHome, you can automatically generate a standardized black and white component name image for the documentation.

To generate a component image:

  1. Comment on this pull request with the following command, replacing COMPONENT_NAME with your component name in UPPER_CASE format with underscores (e.g., BME280, SHT3X, DALLAS_TEMP):

    @esphomebot generate image COMPONENT_NAME
    
  2. The ESPHome bot will respond with a downloadable ZIP file containing the SVG image.

  3. Extract the SVG file and place it in the images/ folder of this repository.

  4. Use the image in your component's index table entry in /components/index.rst.

Example: For a component called "DHT22 Temperature Sensor", use:

@esphomebot generate image DHT22

@Copilot Copilot AI review requested due to automatic review settings August 26, 2025 09:25
@esphome esphome bot added the current label Aug 26, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the development container configuration to work with the documentation's migration from reStructuredText/Sphinx to Markdown/Hugo. The changes ensure developers can properly build and preview the documentation locally.

Key changes:

  • Updates development environment to support Hugo static site generator
  • Adds required tooling (npm, Hugo, markdownlint) for the new documentation stack
  • Configures automatic pre-commit hook installation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.devcontainer/postCreate.sh Adds pre-commit installation and setup
.devcontainer/devcontainer.json Configures Hugo, Node.js, and markdownlint extension with updated port forwarding

Comment on lines +5 to +6
pip3 install --upgrade pre-commit
pre-commit install
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

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

Consider adding error handling for the pre-commit commands. If pre-commit installation fails, the subsequent install command will also fail. You could add set -e at the top of the script to exit on any command failure, or add explicit error checking for each command.

Copilot uses AI. Check for mistakes.

Copy link

netlify bot commented Aug 26, 2025

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit b726b1a
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/68ad7d7f8b66d800089a20e0
😎 Deploy Preview https://deploy-preview-5293--esphome.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.

Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Walkthrough

Updated devcontainer to forward port 1313, add Node and Hugo features (Hugo v0.147.8), and include the markdownlint VS Code extension. Modified postCreate.sh to install and initialize pre-commit, removing PageFind CLI download, while keeping requirements installation.

Changes

Cohort / File(s) Summary
Devcontainer configuration
\.devcontainer/devcontainer.json``
Changed forwardPorts [8000] → [1313]. Added features: node:1 and hugo:1 (version v0.147.8). Updated VS Code extensions to include DavidAnson.vscode-markdownlint alongside ms-python.python.
Post-create provisioning
\.devcontainer/postCreate.sh``
Removed PageFind CLI curl/tar install. Added pip3 install --upgrade pre-commit and pre-commit install. Retained pip3 install -r requirements.txt -r requirements_test.txt.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant VSCode as VS Code
  participant DevC as Dev Container
  participant Post as postCreate.sh
  participant Pip as pip3

  VSCode->>DevC: Open in container
  Note over DevC: Build container with features<br/>- node:1<br/>- hugo:1 (v0.147.8)<br/>Forward port: 1313
  DevC-->>VSCode: Container ready
  DevC->>Post: Run postCreate.sh

  rect rgba(200,230,255,0.3)
    Post->>Pip: install -r requirements.txt -r requirements_test.txt
    Post->>Pip: install --upgrade pre-commit
    Post->>Post: pre-commit install
  end

  Note over Post,DevC: PageFind CLI download removed
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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: 1

🧹 Nitpick comments (1)
.devcontainer/postCreate.sh (1)

1-7: Make the script fail-fast and deterministic.

Minor hardening so devcontainer setup errors don’t get swallowed and Python tool installs target the right interpreter.

Apply this diff:

 #!/bin/bash
 
+set -Eeuo pipefail
+# Optional: reduce noisy errors when a subshell exits (Bash 5.0+); ignore if unsupported.
+shopt -s inherit_errexit || true
+
-python3 -m pip install -r requirements.txt -r requirements_test.txt
-pip3 install --upgrade pre-commit
-pre-commit install
+python3 -m pip install -r requirements.txt -r requirements_test.txt
+python3 -m pip install --upgrade pre-commit
+# Pre-download hooks so first commit is fast.
+pre-commit install --install-hooks

If you prefer to keep project deps isolated from the toolchain, consider installing pre-commit via pipx instead of mixing it into the project venv. Happy to provide a variant if you want it.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear 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 bdf8489 and b726b1a.

📒 Files selected for processing (2)
  • .devcontainer/devcontainer.json (1 hunks)
  • .devcontainer/postCreate.sh (1 hunks)
🔇 Additional comments (4)
.devcontainer/postCreate.sh (1)

5-6: Pre-commit bootstrap is a good addition for contributor ergonomics.

Installing and initializing pre-commit in postCreate ensures hooks are present without asking contributors to do extra steps.

.devcontainer/devcontainer.json (3)

6-8: Port 1313 forward is correct for Hugo’s dev server.

Matches the default port that hugo server binds to, making preview reachable without extra config.


18-21: Adding markdownlint is a nice DX improvement.

Good default for a Markdown/Hugo repo; keeps formatting consistent in PRs.


6-8: Sanity check complete: live-html target serves on port 1313

The Makefile defines the live-html target as follows (lines 38–41):

live-html:
	$(PAGEFIND)
	hugo server --bind 0.0.0.0 --baseURL http://localhost:1313

Hugo defaults to port 1313 when no --port flag is provided, so forwarding port 1313 is correct. No changes necessary.

Comment on lines +12 to +14
"ghcr.io/devcontainers/features/hugo:1": {
"version": "v0.147.8" // Matches version used in netlify.toml
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix Hugo feature version: drop the leading “v”.

The Dev Containers Hugo feature expects a plain semver (e.g., 0.147.8), not a tag with “v” prefix. Using “v0.147.8” will fail the feature install. Also, 0.147.8 is a valid Hugo release. (discourse.gohugo.io, github.com)

Apply this diff:

-    "ghcr.io/devcontainers/features/hugo:1": {
-      "version": "v0.147.8" // Matches version used in netlify.toml
-    }
+    "ghcr.io/devcontainers/features/hugo:1": {
+      "version": "0.147.8", // Matches version used in netlify.toml
+      // Optional but recommended if the site uses SCSS/SASS (most themes do):
+      // installs the extended build of Hugo.
+      "extended": true
+    }

Notes:

  • The “extended” option enables SCSS/SASS processing in themes; add it if your docs theme uses SCSS. (dev.to, theindiecoder.cloud)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"ghcr.io/devcontainers/features/hugo:1": {
"version": "v0.147.8" // Matches version used in netlify.toml
}
"ghcr.io/devcontainers/features/hugo:1": {
"version": "0.147.8", // Matches version used in netlify.toml
// Optional but recommended if the site uses SCSS/SASS (most themes do):
// installs the extended build of Hugo.
"extended": true
}
🤖 Prompt for AI Agents
.devcontainer/devcontainer.json around lines 12 to 14: the Hugo feature version
currently uses a “v” prefixed tag ("v0.147.8") which the Dev Containers feature
expects as a plain semver; remove the leading "v" to set "version": "0.147.8"
and (optionally) add the extended flag by including "extended": true so
SCSS/SASS support is available for themes that need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant