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

feat: Show Cardinal info at cardinal start #98

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

ezavada
Copy link
Contributor

@ezavada ezavada commented Feb 11, 2025

  • Reports the Redis, Cardinal, and Cardinal Editor ports for the cardinal start command.
  • pauses after showing info until user hits

Closes: PLAT-10

Summary by CodeRabbit

  • New Features
    • The startup command now shows a visually enhanced header along with clear service addresses.
    • An interactive prompt has been introduced to pause execution until the user confirms readiness.
    • The process for launching the editor now ensures that a proper, available port is used for a smoother experience.

- Reports the Redis, Cardinal, and Cardinal Editor ports for the `cardinal start` command.
- pauses after showing info until user hits <ENTER>
Copy link

coderabbitai bot commented Feb 11, 2025

Walkthrough

The changes refactor the startCmd functionality in the Cardinal game shard by introducing structured output and improved control flow. The command now prints a styled header, displays Redis and Cardinal service addresses, and conditionally finds an unused port for the Cardinal Editor when the runEditor flag is set. Additionally, a prompt instructing the user to press <ENTER> is added prior to continuing with the container log output. The services to start are now retrieved using a dedicated function, enhancing code clarity.

Changes

File Change Summary
cmd/.../start.go Updated imports (bufio, os, style); refactored header printing using style.CLIHeader; adjusted port detection with common.FindUnusedPort based on the runEditor flag; added user prompt before log output; and delegated service retrieval to getServices(cfg).

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant StartCmd
  participant PortFinder as common.FindUnusedPort
  participant Services as getServices(cfg)
  participant Docker

  User->>StartCmd: Execute "world cardinal start"
  StartCmd->>User: Display header (style.CLIHeader)
  StartCmd->>User: Show Redis and Cardinal service addresses
  alt runEditor enabled
    StartCmd->>PortFinder: Find available port for Cardinal Editor
  end
  StartCmd->>User: Prompt "Press <ENTER> to continue"
  User->>StartCmd: Press <ENTER>
  StartCmd->>Services: Retrieve services list
  Services-->>StartCmd: Return services
  StartCmd->>Docker: Start services via Docker
Loading

Assessment against linked issues

Objective (PLAT-10) Addressed Explanation
Show information about Cardinal editor address and port [PLAT-10]
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

graphite-app bot commented Feb 11, 2025

How to use the Graphite Merge Queue

Add the label graphite/merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@ezavada ezavada marked this pull request as ready for review February 11, 2025 19:09
@ezavada ezavada requested a review from zulkhair February 11, 2025 19:09
Copy link

@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)
cmd/world/cardinal/start.go (1)

134-135: Consider handling ReadBytes error.

The error from ReadBytes is currently discarded. While this might be acceptable for user input, consider logging the error for debugging purposes.

-_, _ = bufio.NewReader(os.Stdin).ReadBytes('\n')
+if _, err := bufio.NewReader(os.Stdin).ReadBytes('\n'); err != nil {
+    // Log the error but continue execution
+    fmt.Fprintf(os.Stderr, "Warning: Error reading user input: %v\n", err)
+}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e8a9e28 and 2a72dfc.

📒 Files selected for processing (1)
  • cmd/world/cardinal/start.go (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Go
  • GitHub Check: Go
  • GitHub Check: Unit & Coverage
  • GitHub Check: Go
  • GitHub Check: Analyze (go)
🔇 Additional comments (3)
cmd/world/cardinal/start.go (3)

4-17: LGTM! Import changes align with new functionality.

The new imports are properly organized and support the enhanced user interaction features.


115-131: LGTM! Well-structured service information display.

The implementation provides clear visibility of service addresses and properly handles the Cardinal Editor configuration.


150-154: LGTM! Improved code organization.

Moving service configuration to getServices enhances maintainability while preserving robust error handling.

Copy link
Collaborator

@zulkhair zulkhair left a comment

Choose a reason for hiding this comment

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

Tested on my local 👍🏻

image.png

@ezavada ezavada merged commit 04a5d7e into main Feb 12, 2025
8 of 10 checks passed
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.

2 participants