Skip to content

fix-groups: fix groups#70

Merged
rprtr258 merged 1 commit intomasterfrom
fix-groups
Aug 2, 2025
Merged

fix-groups: fix groups#70
rprtr258 merged 1 commit intomasterfrom
fix-groups

Conversation

@rprtr258
Copy link
Owner

@rprtr258 rprtr258 commented Aug 2, 2025

Summary by CodeRabbit

  • Refactor

    • Improved the organization and grouping of CLI commands for better maintainability and consistency.
    • Simplified the structure of the project configuration file for easier readability.
    • Updated ignore patterns to streamline repository management.
  • Chores

    • Removed legacy files and directories related to process management utilities.

@coderabbitai
Copy link

coderabbitai bot commented Aug 2, 2025

Walkthrough

This change removes the .pms directory and its contents, restructures the mani.yaml configuration by grouping projects by language, and refactors CLI command group assignment in the codebase. The CLI commands' GroupID fields are removed and replaced with a new helper function for group management. The .gitignore is updated to exclude the .pms directory.

Changes

Cohort / File(s) Change Summary
.pms Directory Removal
.pms/.gitignore, .pms/c/main.c
Deleted the .pms directory, including a process management C utility and a local ignore file for process manager artifacts.
YAML Configuration Restructure
.pms/mani.yaml
Restructured the YAML file to group projects by programming language, removing tags and task sections.
Git Ignore Update
.gitignore
Added /.pms/ to ignore the .pms directory at the repository root.
CLI Command Group Refactor
internal/cli/cli.go
Introduced the addGroup helper function to manage CLI command groups programmatically.
CLI Command GroupID Field Removal
internal/cli/attach.go, internal/cli/delete.go, internal/cli/inspect.go, internal/cli/list.go, internal/cli/logs.go, internal/cli/restart.go, internal/cli/run.go, internal/cli/signal.go, internal/cli/start.go, internal/cli/stop.go, internal/cli/tui.go
Removed the GroupID field from CLI command definitions to centralize group assignment logic.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant RootCmd as Root Cobra Command
    participant addGroup as addGroup Helper

    Dev->>RootCmd: Define command groups (e.g., Inspection, Management)
    Dev->>addGroup: Call addGroup(RootCmd, "Inspection", [cmd1, cmd2, ...])
    addGroup->>RootCmd: Add group with ID and title
    loop For each subcommand
        addGroup->>RootCmd: Add subcommand to RootCmd
        addGroup->>RootCmd: Assign group ID to subcommand
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Poem

A bunny hops through code so neat,
Sweeping .pms away in one swift beat.
Commands regroup and YAMLs align,
With helpers to organize, all looks fine.
Ignore the clutter, let structure bloom—
This rabbit’s work brings tidy room!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

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


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 89716ca and 4d81b36.

📒 Files selected for processing (16)
  • .gitignore (1 hunks)
  • .pms/.gitignore (0 hunks)
  • .pms/c/main.c (0 hunks)
  • .pms/mani.yaml (1 hunks)
  • internal/cli/attach.go (0 hunks)
  • internal/cli/cli.go (2 hunks)
  • internal/cli/delete.go (0 hunks)
  • internal/cli/inspect.go (0 hunks)
  • internal/cli/list.go (0 hunks)
  • internal/cli/logs.go (0 hunks)
  • internal/cli/restart.go (0 hunks)
  • internal/cli/run.go (1 hunks)
  • internal/cli/signal.go (0 hunks)
  • internal/cli/start.go (0 hunks)
  • internal/cli/stop.go (0 hunks)
  • internal/cli/tui.go (0 hunks)
💤 Files with no reviewable changes (12)
  • internal/cli/logs.go
  • internal/cli/restart.go
  • internal/cli/attach.go
  • internal/cli/list.go
  • internal/cli/tui.go
  • internal/cli/inspect.go
  • internal/cli/delete.go
  • internal/cli/start.go
  • internal/cli/stop.go
  • .pms/c/main.c
  • .pms/.gitignore
  • internal/cli/signal.go
✅ Files skipped from review due to trivial changes (1)
  • .pms/mani.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • .gitignore
  • internal/cli/run.go
  • internal/cli/cli.go
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-groups

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

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

@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)
.pms/mani.yaml (1)

1-50: Consider moving mani.yaml out of an ignored directory

Because /.gitignore now ignores /.pms/, any new files added under that directory will be untracked. mani.yaml is already tracked, so it will still work, but future edits or additional helper files risk being silently skipped by contributors.

If the intention is to keep this manifest around, place it somewhere outside an ignored path (e.g. infra/mani.yaml) or drop the /.pms/ ignore rule for mani.yaml.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0fab8aa and 89716ca.

📒 Files selected for processing (16)
  • .gitignore (1 hunks)
  • .pms/.gitignore (0 hunks)
  • .pms/c/main.c (0 hunks)
  • .pms/mani.yaml (1 hunks)
  • internal/cli/attach.go (0 hunks)
  • internal/cli/cli.go (2 hunks)
  • internal/cli/delete.go (0 hunks)
  • internal/cli/inspect.go (0 hunks)
  • internal/cli/list.go (0 hunks)
  • internal/cli/logs.go (0 hunks)
  • internal/cli/restart.go (0 hunks)
  • internal/cli/run.go (1 hunks)
  • internal/cli/signal.go (0 hunks)
  • internal/cli/start.go (0 hunks)
  • internal/cli/stop.go (0 hunks)
  • internal/cli/tui.go (0 hunks)
💤 Files with no reviewable changes (12)
  • internal/cli/tui.go
  • internal/cli/list.go
  • internal/cli/stop.go
  • internal/cli/start.go
  • internal/cli/delete.go
  • internal/cli/signal.go
  • internal/cli/inspect.go
  • internal/cli/attach.go
  • internal/cli/logs.go
  • .pms/.gitignore
  • internal/cli/restart.go
  • .pms/c/main.c
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: rprtr258
PR: rprtr258/pm#49
File: internal/infra/app/app.go:0-0
Timestamp: 2024-06-29T10:48:17.812Z
Learning: rprtr258 prefers not to use the phrase "failed to" in error messages.
📚 Learning: when implementing the `stop` command in the cli, ensure to filter for running processes by checking ...
Learnt from: rprtr258
PR: rprtr258/pm#49
File: internal/infra/cli/stop.go:56-63
Timestamp: 2024-06-29T10:49:07.218Z
Learning: When implementing the `stop` command in the CLI, ensure to filter for running processes by checking the `Status` field in the `ProcStat` struct.

Applied to files:

  • internal/cli/run.go
🪛 YAMLlint (1.37.1)
.pms/mani.yaml

[error] 36-36: duplication of key "ruby" in mapping

(key-duplicates)

🔇 Additional comments (5)
internal/cli/run.go (1)

275-276: LGTM! Clean formatting improvement.

The removal of extra spaces in the Use and Short fields improves code consistency. The removal of the GroupID field aligns with the centralized group management approach introduced in cli.go.

internal/cli/cli.go (3)

3-7: LGTM! Necessary import addition.

The strings import is required for the strings.ToLower() call in the new addGroup function.


9-23: Excellent refactoring! Centralizes group management logic.

This helper function effectively consolidates group creation and command assignment, reducing code duplication and improving maintainability. The implementation correctly:

  • Generates consistent group IDs using strings.ToLower()
  • Creates proper cobra groups with formatted titles
  • Assigns group membership to all provided commands

This approach is much cleaner than the previous explicit group assignments.


37-50: Well-organized command grouping using the new helper.

The logical separation of commands into "Inspection" and "Management" groups makes sense:

  • Inspection: Read-only operations (list, logs, inspect)
  • Management: Process control operations (run, start, restart, stop, delete, signal, attach)

The usage of the new addGroup function is consistent and clean, successfully replacing the previous explicit approach.

.gitignore (1)

6-6: 👍 Good call ignoring the entire .pms directory

Adding /.pms/ prevents resurrecting the removed tooling.
No functional issues spotted here.

@rprtr258 rprtr258 merged commit c767f8e into master Aug 2, 2025
3 checks passed
@rprtr258 rprtr258 deleted the fix-groups branch August 2, 2025 11:47
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