feat: Add AI coding assistant rules command
Summary
Adds a new shuttle ai rules command 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
-
New
ai rulessubcommand: Allows developers to generate AI assistant rules files for their preferred platform -
Multi-platform support: Supports 5 AI coding assistants:
- Cursor (
.cursor/rules/shuttle.mdc) - Claude Code (
CLAUDE.md) - Windsurf (
.windsurf/rules/shuttle.md) - Gemini CLI (
GEMINI.md) - Codex CLI (
AGENTS.md)
- Cursor (
- Interactive mode: If no platform flag is provided, presents an interactive selection menu
-
Smart file handling:
- Overwrites existing rules files for directory-based configs (Cursor, Windsurf)
- Appends to existing files for top-level markdown configs (Claude, Gemini, Codex)
- Prompts for confirmation before overwriting/appending
-
Comprehensive rules: Includes best practices for:
- Core setup with
#[shuttle_runtime::main] - Database configuration (shared DB vs AWS RDS)
- Secrets management
- Static assets configuration
- Development workflow
- Core setup with
Usage
# Interactive mode - select platform from menu
shuttle ai rules
# Generate for specific platform
shuttle ai rules --cursor
shuttle ai rules --claude
shuttle ai rules --windsurf
shuttle ai rules --gemini
shuttle ai rules --codex
Technical Details
- Rules content is embedded at compile time using
include_str!fromai-rules.md - New module
cargo-shuttle/src/ai.rshandles all AI rules logic - Uses
dialoguercrate for interactive CLI prompts - Platform-specific file paths and behaviors are encapsulated in the
AiPlatformenum
Testing
Tested all platforms:
- ✓ Interactive mode selection
- ✓ Platform-specific flags
- ✓ File creation in correct locations
- ✓ Overwrite/append confirmation prompts
- ✓ Directory creation for nested paths
🤖 Generated with Claude Code
Based on what I heard from Nathan, it seems like most AI tools will respect agents.md nowadays, so maybe the list of choices can be reduced (please fact check).
Thus, is seems we are aiming to call the command generate agents (expanding the current generate subcommand) in a future update, so maybe we want to call it that now already.