Skip to content

Comments

feat: add shell specific configurations#36

Merged
greggh merged 2 commits intogreggh:mainfrom
MartianGreed:main
Jun 10, 2025
Merged

feat: add shell specific configurations#36
greggh merged 2 commits intogreggh:mainfrom
MartianGreed:main

Conversation

@MartianGreed
Copy link
Contributor

@MartianGreed MartianGreed commented Jun 3, 2025

Pull Request

Description

As a nushell user, I can't use the extension because shell values are hardcoded.

Type of Change

Please check the options that are relevant:

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Other (please describe):

Checklist

Please check all that apply:

  • I have read the CONTRIBUTING document
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have tested with the actual Claude Code CLI tool
  • I have tested in different environments (if applicable)

Screenshots (if applicable)

Add screenshots to help explain your changes if they include visual elements.

Additional Notes

Add any other context about the PR here.

Summary by CodeRabbit

  • New Features

    • Added configurable shell command options, allowing users to customize directory navigation commands and command separators for terminal operations.
  • Documentation

    • Updated the README with examples and explanations for the new shell configuration options.
  • Tests

    • Added tests to verify terminal command construction with custom shell settings.

@coderabbitai
Copy link

coderabbitai bot commented Jun 3, 2025

Walkthrough

The changes introduce a configurable shell section for command construction in the codebase. This includes new settings for the shell command separator and directory stack commands, updated documentation, validation logic, dynamic command assembly in terminal operations, and a new test to verify custom shell configuration usage.

Changes

File(s) Change Summary
README.md Added documentation for new shell configuration section and its fields (separator, pushd_cmd, popd_cmd).
lua/claude-code/config.lua Introduced ClaudeCodeShell class and updated config validation and defaults to include shell settings.
lua/claude-code/terminal.lua Updated terminal command construction to use configurable shell commands and separator.
tests/spec/terminal_spec.lua Added test to verify terminal command uses custom shell configuration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Config
    participant Terminal

    User->>Config: Set custom shell commands (pushd_cmd, popd_cmd, separator)
    User->>Terminal: Toggle terminal with command
    Terminal->>Config: Retrieve shell config
    Terminal->>Terminal: Build command using custom shell config
    Terminal->>User: Execute terminal command with custom shell logic
Loading

Poem

A rabbit hopped into its shell,
With pushd and popd, it knew so well.
But now with commands you can define,
Separator and stack—how divine!
Custom hops with every call,
This bunny’s shell can do it all! 🐇✨


📜 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 ffdf35d and 2b09935.

📒 Files selected for processing (4)
  • README.md (1 hunks)
  • lua/claude-code/config.lua (3 hunks)
  • lua/claude-code/terminal.lua (1 hunks)
  • tests/spec/terminal_spec.lua (2 hunks)
🔇 Additional comments (7)
lua/claude-code/config.lua (3)

50-55: LGTM: Well-documented shell configuration class.

The documentation clearly describes the purpose of each field and provides helpful examples for different shell environments.


91-96: LGTM: Sensible default values for shell configuration.

The default values (&&, pushd, popd) are appropriate for the most common shell environments (bash/zsh) and provide good backward compatibility.


195-211: LGTM: Comprehensive validation for shell configuration.

The validation properly ensures all shell configuration fields are present and are strings, following the same pattern as other configuration sections.

lua/claude-code/terminal.lua (1)

152-155: LGTM: Properly implements configurable shell commands.

The implementation correctly replaces hardcoded shell commands with configurable values from config.shell, enabling support for different shell environments like nushell. The command construction maintains the same structure while using the configured separator, pushd_cmd, and popd_cmd values.

README.md (1)

112-117: LGTM: Clear and helpful documentation for shell configuration.

The documentation effectively explains the new shell configuration options with practical examples for different shell environments. The comments clearly indicate the differences between bash/zsh and nushell usage, making it easy for users to configure appropriately.

tests/spec/terminal_spec.lua (2)

88-92: LGTM: Proper test configuration setup.

The test setup correctly includes the shell configuration with default values, ensuring the tests reflect the actual configuration structure.


309-331: LGTM: Comprehensive test for custom shell commands.

The test effectively verifies that custom shell commands and separators are properly used in terminal command construction. It uses realistic nushell values (enter, exit, ;) and properly validates the resulting command string matches the expected pattern.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

@greggh
Copy link
Owner

greggh commented Jun 10, 2025

Those errors in the CI can be ignored for now. All good.

@greggh greggh merged commit d7f55c7 into greggh:main Jun 10, 2025
7 of 11 checks passed
@greggh greggh mentioned this pull request Jun 10, 2025
9 tasks
@coderabbitai coderabbitai bot mentioned this pull request Jun 20, 2025
14 tasks
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