Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add atmos docs <component> command #751

Merged
merged 7 commits into from
Oct 30, 2024

Conversation

RoseSecurity
Copy link
Member

@RoseSecurity RoseSecurity commented Oct 29, 2024

what

  • Renders component documentation utilizing the atmos docs <component> command

atmos_docs

why

  • Improve user experience when navigating component documentation

testing

  • Ensure existing functionality to the docs command is not affected
  • Tested without valid Atmos Base Path
  • Tested with nonexistent component name
  • Tested with valid component name
  • Tested with invalid component name
  • Tested with nested component names

references

Summary by CodeRabbit

  • New Features

    • Enhanced documentation command to display specific Atmos component documentation.
    • Added example usage for specifying components in the documentation command.
  • Bug Fixes

    • Improved error handling for missing component directories and README files.
  • Documentation

    • Updated documentation for the atmos docs command to clarify functionality and provide usage examples.
  • Chores

    • Updated dependencies to ensure compatibility and introduce new libraries for functionality enhancements.

Copy link
Contributor

coderabbitai bot commented Oct 29, 2024

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes introduce enhancements to the docsCmd command in the cmd/docs.go file, allowing users to access documentation for specific Atmos components. The command now accepts an optional argument for specifying a component, validates it, and checks for the existence of a corresponding directory and README file. If the README exists, its content is rendered; otherwise, appropriate errors are logged. Additionally, the go.mod file has been updated to include new dependencies and update existing ones, ensuring the project uses the latest compatible versions.

Changes

File Change Summary
cmd/docs.go Expanded docsCmd functionality to display documentation for specific components; updated descriptions and added example usage; implemented argument validation and error handling for component directories and README files.
go.mod Added new direct dependency github.com/charmbracelet/glamour v0.8.0 and several indirect dependencies; updated existing dependencies to newer versions.
website/docs/cli/commands/docs.mdx Updated documentation for the atmos docs command to include usage examples and clarify functionality regarding general and specific documentation access.

Possibly related PRs

  • Add atmos docs <component> command #751: This PR directly relates to the main PR as it introduces the atmos docs <component> command, which enhances the functionality of the docsCmd in cmd/docs.go to display documentation for specific Atmos components, similar to the changes made in the main PR.

Suggested reviewers

  • osterman
  • Gowiem

Poem

In the land of code where rabbits play,
New docs command brightens the day.
With components to show and README to read,
Our knowledge will flourish, yes indeed!
So hop along, dear friends, don't delay,
Explore the docs, let curiosity lead the way! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

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.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between a48ed22 and e67ca58.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • cmd/docs.go (1 hunks)
  • go.mod (8 hunks)
🔇 Additional comments (2)
go.mod (2)

13-13: LGTM! Dependencies align well with the PR objectives.

The new dependencies are appropriate for implementing markdown rendering functionality:

  • github.com/charmbracelet/glamour for terminal markdown rendering
  • Supporting dependencies for HTML sanitization, syntax highlighting, and markdown parsing

The changes are well-structured and use stable versions from reputable sources.

Also applies to: 62-62, 89-89, 107-107, 132-132, 174-174, 184-184, 222-223


185-185: 🧹 Nitpick (assertive)

Consider using a stable version of termenv.

The dependency github.com/muesli/termenv is using a pre-release version (v0.15.3-0.20240618155329-98d742f6907a). While this might be required by glamour, consider checking if a stable version would work to avoid potential instability.

cmd/docs.go Outdated Show resolved Hide resolved
cmd/docs.go Outdated Show resolved Hide resolved
@osterman
Copy link
Member

Also, please add a note about the new functionality to https://atmos.tools/cli/commands/docs/#usage

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between e67ca58 and ced4c33.

📒 Files selected for processing (1)
  • website/docs/cli/commands/docs.mdx (1 hunks)
🔇 Additional comments (1)
website/docs/cli/commands/docs.mdx (1)

17-18: LGTM! Clear explanation of the command's dual functionality.

The description effectively communicates both the default behavior and the new component-specific documentation feature.

website/docs/cli/commands/docs.mdx Show resolved Hide resolved
@aknysh aknysh added the minor New features that do not break anything label Oct 30, 2024
Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

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

@RoseSecurity thanks, LGTM.
Please resolve the conflicts and address the Coderabbit suggestion

@aknysh aknysh added no-release Do not create a new release (wait for additional code changes) and removed minor New features that do not break anything labels Oct 30, 2024
Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

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

LGTM, please address comments

Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

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

thanks @RoseSecurity

@aknysh aknysh added minor New features that do not break anything and removed no-release Do not create a new release (wait for additional code changes) labels Oct 30, 2024
@aknysh aknysh changed the title feat: add atmos docs <component> functionality Add atmos docs <component> command Oct 30, 2024
@aknysh aknysh merged commit 8db8f6e into cloudposse:main Oct 30, 2024
23 of 25 checks passed
Copy link

These changes were released in v1.98.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor New features that do not break anything
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants