shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

feat: Add AI coding assistant rules command

Open dcodesdev opened this issue 2 months ago • 1 comments

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 rules subcommand: 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)
  • 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

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! from ai-rules.md
  • New module cargo-shuttle/src/ai.rs handles all AI rules logic
  • Uses dialoguer crate for interactive CLI prompts
  • Platform-specific file paths and behaviors are encapsulated in the AiPlatform enum

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

dcodesdev avatar Oct 23 '25 09:10 dcodesdev

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.

jonaro00 avatar Oct 28 '25 12:10 jonaro00