-
Notifications
You must be signed in to change notification settings - Fork 281
feat: Add AI coding assistant rules command #2128
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Adds shuttle ai rules command that generates AI coding assistant configuration files with Shuttle-specific development rules for 5 platforms (Cursor, Claude Code, Windsurf, Gemini CLI, Codex CLI).
Key Changes:
- New
ai-rules.mdcontaining Shuttle best practices and development guidelines - Interactive platform selection with
dialoguercrate when no flag provided - Smart append vs overwrite behavior: directory-based configs overwrite, top-level markdown files append
- User confirmation prompts before modifying existing files
- Platform-specific file paths encapsulated in
AiPlatformenum
Implementation Notes:
- Rules content embedded at compile time via
include_str!macro - Mutually exclusive CLI flags ensure single platform selection
- All command integration follows existing patterns in the codebase
Confidence Score: 4/5
- This PR is safe to merge with minor style improvements recommended
- The implementation is solid and follows existing patterns. The logic is straightforward with proper error handling and user confirmations. Two minor issues: missing function documentation per custom instructions, and a capitalization helper that could handle Unicode better. No functional bugs detected.
- cargo-shuttle/src/ai.rs could benefit from adding doc comments to public functions per custom instructions
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| ai-rules.md | 4/5 | New markdown file containing Shuttle-specific development rules and best practices for AI coding assistants |
| cargo-shuttle/src/ai.rs | 4/5 | New module implementing AI rules command with platform selection, file writing, and user confirmation logic |
| cargo-shuttle/src/args.rs | 5/5 | Added AiCommand and AiRulesArgs with mutually exclusive platform flags for the new shuttle ai rules command |
| cargo-shuttle/src/lib.rs | 5/5 | Integrated new AI module and added command handler for Command::Ai that delegates to ai::handle_ai_rules |
4 files reviewed, 2 comments
cargo-shuttle/src/ai.rs
Outdated
| /// Handle the `ai rules` command | ||
| pub fn handle_ai_rules(args: &AiRulesArgs, working_directory: &Path) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Missing doc comment explaining the purpose of this function
According to custom instructions, functions should have comments explaining their purpose, especially for new functionality.
Context Used: Context from dashboard - Include comments explaining the purpose of functions, especially for new or complex functionality. (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: cargo-shuttle/src/ai.rs
Line: 55:56
Comment:
**style:** Missing doc comment explaining the purpose of this function
According to custom instructions, functions should have comments explaining their purpose, especially for new functionality.
**Context Used:** Context from `dashboard` - Include comments explaining the purpose of functions, especially for new or complex functionality. ([source](https://app.greptile.com/review/custom-context?memory=fe8549ea-5239-4b00-a674-867d405455c8))
How can I resolve this? If you propose a fix, please make it concise.| ) && file_path.exists(); | ||
|
|
||
| // Check if file already exists | ||
| if file_path.exists() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: String capitalization logic assumes ASCII first character. Use to_uppercase() instead for proper Unicode handling.
| if file_path.exists() { | |
| action.chars().next().map(|c| c.to_uppercase().collect::<String>()).unwrap_or_default() + &action[1..] |
Prompt To Fix With AI
This is a comment left during a code review.
Path: cargo-shuttle/src/ai.rs
Line: 130:130
Comment:
**style:** String capitalization logic assumes ASCII first character. Use `to_uppercase()` instead for proper Unicode handling.
```suggestion
action.chars().next().map(|c| c.to_uppercase().collect::<String>()).unwrap_or_default() + &action[1..]
```
How can I resolve this? If you propose a fix, please make it concise.|
Based on what I heard from Nathan, it seems like most AI tools will respect Thus, is seems we are aiming to call the command |
Summary
Adds a new
shuttle ai rulescommand that generates AI coding assistant configuration files with Shuttle-specific development rules and best practices. This helps developers get better AI assistance when working on Shuttle projects by providing context-aware rules to popular AI coding tools.Changes
ai rulessubcommand: Allows developers to generate AI assistant rules files for their preferred platform.cursor/rules/shuttle.mdc)CLAUDE.md).windsurf/rules/shuttle.md)GEMINI.md)AGENTS.md)#[shuttle_runtime::main]Usage
Technical Details
include_str!fromai-rules.mdcargo-shuttle/src/ai.rshandles all AI rules logicdialoguercrate for interactive CLI promptsAiPlatformenumTesting
Tested all platforms:
🤖 Generated with Claude Code