Skip to content

Conversation

BaptisteGi
Copy link
Contributor

@BaptisteGi BaptisteGi commented Jul 24, 2025

This pull request updates the documentation prompt to align with the Diátaxis framework, and fully refreshes the generator guide accordingly.

Key improvements made to follow the documentation guidelines include:

  • Introducing a clearer guide structure with new sections: "What You'll Build" and "Steps Overview"
  • Moving all content not directly related to the task into a dedicated "Prerequisites" section
  • Refocusing the guide to be task-oriented, removing explanatory or conceptual teaching
  • Adding decision boxes to help users make informed choices where relevant
  • Including explicit validation steps to help users confirm their progress

Summary by CodeRabbit

  • Documentation
    • Expanded and clarified documentation instructions to adopt the Diataxis framework, providing detailed guidance and checklists for writing guides and topics.
    • Extensively rewrote and reorganized the generator creation guide, adding step-by-step instructions, updated examples, and clearer structure for improved usability.
    • Updated style and spelling exception lists to improve documentation consistency and accuracy.

Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

The updates focus on documentation improvements and linting configuration enhancements. Documentation instructions now explicitly adopt the Diataxis framework, providing separate, detailed guidance for task-oriented guides and understanding-oriented topics. A generator creation guide was thoroughly rewritten with expanded steps, examples, and clearer structure. Vale linter configurations were updated with new exceptions for sentence casing and spelling.

Changes

Files/Paths Change Summary
.github/instructions/documentation.instructions.md Expanded to adopt Diataxis framework, detailing distinct structures and styles for guides and topics, and providing tailored checklists for each documentation type.
docs/docs/guides/generator.mdx Extensively rewritten and expanded guide on creating a generator, with clarified steps, updated examples, improved structure, and additional guidance for setup, implementation, testing, and deployment.
.vale/styles/Infrahub/sentence-case.yml Added "IDE" and "AI" as exceptions to sentence-case enforcement in the Vale linter configuration.
.vale/styles/spelling-exceptions.txt Added "Widget's" and "widget's" as accepted spelling exceptions for the Vale linter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bgi-refresh-generator-guide

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

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.

@github-actions github-actions bot added type/documentation Improvements or additions to documentation group/ci Issue related to the CI pipeline labels Jul 24, 2025
@BaptisteGi BaptisteGi marked this pull request as ready for review July 24, 2025 13:47
@BaptisteGi BaptisteGi requested review from a team as code owners July 24, 2025 13:47
@BaptisteGi
Copy link
Contributor Author

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 (5)
.vale/styles/spelling-exceptions.txt (1)

164-165: Consider keeping the list strictly alphabetical for faster lookup

New entries are appended at the end. For long exception lists it’s easier to maintain if items stay in case-insensitive alphabetical order. Inserting “AI/IDE”-style terms in the correct place reduces future merge noise.

.vale/styles/Infrahub/sentence-case.yml (1)

86-87: Insert new exceptions in sorted order

AI and IDE drop to the bottom of the list, breaking the existing A→Z flow (see Alpha, Ansible, API, … earlier). Re-sorting now avoids later churn when another contributor runs an auto-sort.

   - Alpha
+  - AI
   - Ansible
   - API
   …
   - UI
   - Vale
   - VS Code extensions
   - WebUI
-  - IDE
-  - AI
+  - IDE
.github/instructions/documentation.instructions.md (1)

45-52: Minor wording tweak for consistency

Line 48 mixes “conditional imperatives” with an imperative example that isn’t conditional. Consider rephrasing to keep examples parallel, e.g. “If you want X, do Y. If you need W, do Z.”

docs/docs/guides/generator.mdx (2)

7-8: Drop the redundant H1 header

Docusaurus renders the page title from front-matter; leaving the # How to create a generator … heading produces a duplicate H1.

-# How to create a generator in Infrahub

41-46: Avoid repetition of “locally”

The word appears twice in two consecutive bullets; trimming one keeps the checklist crisp.

- - [infrahubctl]($(base_url)infrahubctl/infrahubctl) installed and configured locally
- - The repository cloned locally where you'll develop the generator
+ - [infrahubctl]($(base_url)infrahubctl/infrahubctl) installed and configured on your workstation
+ - The repository cloned where you'll develop the generator
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99495f7 and 81db2e6.

📒 Files selected for processing (4)
  • .github/instructions/documentation.instructions.md (5 hunks)
  • .vale/styles/Infrahub/sentence-case.yml (1 hunks)
  • .vale/styles/spelling-exceptions.txt (1 hunks)
  • docs/docs/guides/generator.mdx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
docs/docs/guides/**/*.{md,mdx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Write guides in docs/docs/guides/

Files:

  • docs/docs/guides/generator.mdx
docs/**/*.mdx

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Use Docusaurus markdown/MDX features in documentation

Files:

  • docs/docs/guides/generator.mdx
docs/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Develop documentation in docs/, preview with invoke docs.build docs.serve, and validate with invoke docs.validate

Files:

  • docs/docs/guides/generator.mdx
🧠 Learnings (2)
.github/instructions/documentation.instructions.md (6)

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Applies to docs/docs/guides/**/*.{md,mdx} : Write guides in docs/docs/guides/

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Documentation generated for Infrahub must reflect its novel approach, providing clarity around new concepts and demonstrating integration with familiar patterns from existing tools like Git, infrastructure-as-code, and CI/CD pipelines

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Applies to docs/**/*.mdx : Use Docusaurus markdown/MDX features in documentation

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Applies to docs/docs/reference/**/*.{md,mdx} : Write reference documentation in docs/docs/reference/

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Applies to docs/**/* : Develop documentation in docs/, preview with invoke docs.build docs.serve, and validate with invoke docs.validate

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Applies to {CONTRIBUTING.md,SECURITY.md} : See CONTRIBUTING.md and SECURITY.md at repo root for policies

docs/docs/guides/generator.mdx (2)

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Documentation generated for Infrahub must reflect its novel approach, providing clarity around new concepts and demonstrating integration with familiar patterns from existing tools like Git, infrastructure-as-code, and CI/CD pipelines

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Applies to docs/docs/guides/**/*.{md,mdx} : Write guides in docs/docs/guides/

🪛 LanguageTool
docs/docs/guides/generator.mdx

[style] ~46-~46: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...figured locally - The repository cloned locally where you'll develop the generator ## ...

(ADVERB_REPETITION_PREMIUM)

🔇 Additional comments (2)
docs/docs/guides/generator.mdx (2)

351-359: Confirm .infrahub.yml key names

targets: usually expects a list; parameters: commonly maps filter names directly (name__value: ...) rather than wrapping them in a name: key. Please double-check against the current spec to avoid runtime schema errors.


328-341: Verify availability of self.nodes when convert_query_response: true

With convert_query_response enabled, some SDK versions expose typed objects via self.results instead of self.nodes. Running infrahubctl generator --list followed by a dry-run will confirm.

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 (3)
docs/docs/guides/generator.mdx (3)

2-8: Drop the redundant H1 heading

Docusaurus already renders the page title from the front-matter. Keeping the explicit # How to create a generator in Infrahub results in two visually identical titles. Delete the Markdown heading or, if you prefer keeping it, remove the title: field from the front-matter to avoid duplication.


35-40: Tighten wording to avoid “locally” repetition

Bullet 4 starts with “The repository cloned locally …” immediately after bullet 3 ends with “configured locally”. Consider re-phrasing bullet 4 to drop the second “locally” (e.g. “A clone of the repository where you’ll develop the generator”).


319-337: Minor polish in code snippet

  1. The loop variable count shadows the outer widget_count concept and reads awkwardly (for count in range(1, widget_count + 1)). Renaming it to i or idx improves clarity.
  2. Using self.nodes[0] assumes the query always returns exactly one node. A safer pattern is to iterate over self.nodes or explicitly check length to avoid index errors when the generator is repurposed.

Example diff:

-        widget = self.nodes[0]
+        if not self.nodes:
+            return
+        widget = self.nodes[0]
 ...
-        for count in range(1, widget_count + 1):
+        for idx in range(1, widget_count + 1):
 ...
-              "name": f"{widget_name.lower()}-{count}",
+              "name": f"{widget_name.lower()}-{idx}",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81db2e6 and cdbe288.

📒 Files selected for processing (1)
  • docs/docs/guides/generator.mdx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
docs/docs/guides/**/*.{md,mdx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Write guides in docs/docs/guides/

Files:

  • docs/docs/guides/generator.mdx
docs/**/*.mdx

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Use Docusaurus markdown/MDX features in documentation

Files:

  • docs/docs/guides/generator.mdx
docs/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Develop documentation in docs/, preview with invoke docs.build docs.serve, and validate with invoke docs.validate

Files:

  • docs/docs/guides/generator.mdx
🪛 LanguageTool
docs/docs/guides/generator.mdx

[style] ~40-~40: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...figured locally - The repository cloned locally where you'll develop the generator ## ...

(ADVERB_REPETITION_PREMIUM)

⏰ 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: validate-generated-documentation
  • GitHub Check: documentation
🔇 Additional comments (1)
docs/docs/guides/generator.mdx (1)

345-360: Double-check .infrahub.yml semantics

targets: widgets expects the group ID rather than the display name. If the group ID differs from the literal string "widgets" (for example, it is auto-generated or namespaced), the generator will never match. Please verify the exact group identifier in Infrahub and adjust if necessary.

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 (2)
docs/docs/guides/generator copy.mdx (2)

41-46: Remove the double “locally” to satisfy Vale and improve readability

- [infrahubctl]($(base_url)infrahubctl/infrahubctl) installed and configured locally
- The repository cloned locally where you'll develop the generator
+ [infrahubctl]($(base_url)infrahubctl/infrahubctl) installed and configured
+ A local clone of the repository where you’ll develop the generator

325-343: Example code uses self.nodes, which is not part of the public InfrahubGenerator API

Unless you have a subclass that injects self.nodes, this will raise AttributeError.
Typical access patterns are:

for edge in data["TestWidget"]["edges"]:
    widget = edge["node"]

or, if the SDK provides a typed helper:

widget = self.store.get(widget_id)

Please verify the existence of self.nodes or update the example accordingly.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdbe288 and c164b85.

📒 Files selected for processing (1)
  • docs/docs/guides/generator copy.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
docs/docs/guides/**/*.{md,mdx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Write guides in docs/docs/guides/

Files:

  • docs/docs/guides/generator copy.mdx
docs/**/*.mdx

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Use Docusaurus markdown/MDX features in documentation

Files:

  • docs/docs/guides/generator copy.mdx
docs/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Develop documentation in docs/, preview with invoke docs.build docs.serve, and validate with invoke docs.validate

Files:

  • docs/docs/guides/generator copy.mdx
🪛 LanguageTool
docs/docs/guides/generator copy.mdx

[style] ~46-~46: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...figured locally - The repository cloned locally where you'll develop the generator ## ...

(ADVERB_REPETITION_PREMIUM)

⏰ 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: documentation
  • GitHub Check: validate-generated-documentation
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
docs/docs/guides/generator copy.mdx (2)

351-366: Parameter key mismatches the GraphQL variable name

The GraphQL query declares a variable $name, but the generator definition passes name__value. Unless there is implicit mapping, the variable will be null at runtime.

-    parameters:
-      name: "name__value"
+    parameters:
+      name: "name"

Double-check the infrahubctl parameter-substitution rules and adjust either the query or the YAML accordingly.


9-11: Ensure $(base_url) is actually expanded or switch to a real URL

I couldn’t find any Docusaurus config or plugin that would replace the $(base_url) placeholder at build time. If you’re relying on a custom remark/rehype plugin make sure it’s registered in your docusaurus.config.js (or wherever you configure MDX plugins). Otherwise the link will render literally and break.

Please verify one of the following:

  • You have a plugin in your Docusaurus config that replaces $(base_url) with the site’s base URL.
  • If not, update the link in docs/docs/guides/generator copy.mdx (lines 9–11) to a relative or absolute URL, for example:
    [infrahubctl generator](/infrahubctl/infrahubctl-generator)

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

🧹 Nitpick comments (1)
docs/docs/guides/generator.mdx (1)

35-41: Avoid repetitive wording in prerequisites list.

The word “locally” appears twice in consecutive bullet points, which reads awkwardly (“… installed and configured locally” / “The repository cloned locally…”).
Streamline the sentence to improve flow, e.g.:

- - [infrahubctl]($(base_url)infrahubctl/infrahubctl) installed and configured locally
- - The repository cloned locally where you'll develop the generator
+ - [infrahubctl]($(base_url)infrahubctl/infrahubctl) installed and configured on your machine
+ - A local clone of the repository where you'll develop the generator
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c164b85 and 711d462.

📒 Files selected for processing (1)
  • docs/docs/guides/generator.mdx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
docs/docs/guides/**/*.{md,mdx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Write guides in docs/docs/guides/

Files:

  • docs/docs/guides/generator.mdx
docs/**/*.mdx

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Use Docusaurus markdown/MDX features in documentation

Files:

  • docs/docs/guides/generator.mdx
docs/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Develop documentation in docs/, preview with invoke docs.build docs.serve, and validate with invoke docs.validate

Files:

  • docs/docs/guides/generator.mdx
🪛 LanguageTool
docs/docs/guides/generator.mdx

[style] ~40-~40: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...figured locally - The repository cloned locally where you'll develop the generator ## ...

(ADVERB_REPETITION_PREMIUM)

⏰ 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: documentation
  • GitHub Check: validate-generated-documentation
🔇 Additional comments (2)
docs/docs/guides/generator.mdx (2)

122-140: Schema snippet omits data-type metadata for numeric attribute.

count is declared as kind: Number without specifying number_kind (e.g., Integer, Float) which the schema validator usually expects. Readers copying this snippet may hit validation errors.

Add the explicit subtype:

-      - name: count
-        kind: Number
+      - name: count
+        kind: Number
+        number_kind: Integer

346-356: Parameter mapping in .infrahub.yml may not line up with CLI usage.

The generator calls are shown as positional arguments (name=widget1), but the YAML defines:

parameters:
  name: "name__value"

Depending on the current spec, parameters is either:

  1. A list of objects (- name: ... path: ...) or
  2. A mapping under variables:.

Please verify the expected structure; if the CLI fails to substitute, readers will be blocked at “Step 5”.

@BaptisteGi BaptisteGi merged commit 93bb4a4 into stable Jul 25, 2025
33 checks passed
@BaptisteGi BaptisteGi deleted the bgi-refresh-generator-guide branch July 25, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/ci Issue related to the CI pipeline type/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants