Files
beads/cmd/bd/setup.go
Steve Yegge 89a5752d6e Add Aider integration for beads issue tracking
Implements GH#206 and bd-3djj: Add support for Aider AI pair programming
tool with beads issue tracking.

Changes:
- Added cmd/bd/setup/aider.go with InstallAider, CheckAider, RemoveAider
- Created .aider.conf.yml template with bd workflow instructions
- Added .aider/README.md template with quick reference
- Updated cmd/bd/setup.go to include aider subcommand
- Fixed cmd/bd/main.go to allow setup subcommands without database by
  checking parent command name
- Added comprehensive docs/AIDER_INTEGRATION.md documentation

Key differences from Claude/Cursor integration:
- Aider requires explicit command execution via /run
- AI suggests bd commands rather than running autonomously
- Documentation emphasizes human-in-the-loop workflow
- Config instructs AI to always suggest, never execute

Usage:
  bd setup aider          # Install integration
  bd setup aider --check  # Verify installation
  bd setup aider --remove # Remove integration

Resolves bd-3djj
Related to GH#206

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 15:13:54 -08:00

109 lines
2.9 KiB
Go

package main
import (
"github.com/spf13/cobra"
"github.com/steveyegge/beads/cmd/bd/setup"
)
var (
setupProject bool
setupCheck bool
setupRemove bool
)
var setupCmd = &cobra.Command{
Use: "setup",
Short: "Setup integration with AI editors",
Long: `Setup integration files for AI editors like Claude Code, Cursor, and Aider.`,
}
var setupCursorCmd = &cobra.Command{
Use: "cursor",
Short: "Setup Cursor IDE integration",
Long: `Install Beads workflow rules for Cursor IDE.
Creates .cursor/rules/beads.mdc with bd workflow context.
Uses BEGIN/END markers for safe idempotent updates.`,
Run: func(cmd *cobra.Command, args []string) {
if setupCheck {
setup.CheckCursor()
return
}
if setupRemove {
setup.RemoveCursor()
return
}
setup.InstallCursor()
},
}
var setupAiderCmd = &cobra.Command{
Use: "aider",
Short: "Setup Aider integration",
Long: `Install Beads workflow configuration for Aider.
Creates .aider.conf.yml with bd workflow instructions.
The AI will suggest bd commands for you to run via /run.
Note: Aider requires explicit command execution - the AI cannot
run commands autonomously. It will suggest bd commands which you
must confirm using Aider's /run command.`,
Run: func(cmd *cobra.Command, args []string) {
if setupCheck {
setup.CheckAider()
return
}
if setupRemove {
setup.RemoveAider()
return
}
setup.InstallAider()
},
}
var setupClaudeCmd = &cobra.Command{
Use: "claude",
Short: "Setup Claude Code integration",
Long: `Install Claude Code hooks that auto-inject bd workflow context.
By default, installs hooks globally (~/.claude/settings.json).
Use --project flag to install only for this project.
Hooks call 'bd prime' on SessionStart and PreCompact events to prevent
agents from forgetting bd workflow after context compaction.`,
Run: func(cmd *cobra.Command, args []string) {
if setupCheck {
setup.CheckClaude()
return
}
if setupRemove {
setup.RemoveClaude(setupProject)
return
}
setup.InstallClaude(setupProject)
},
}
func init() {
setupClaudeCmd.Flags().BoolVar(&setupProject, "project", false, "Install for this project only (not globally)")
setupClaudeCmd.Flags().BoolVar(&setupCheck, "check", false, "Check if Claude integration is installed")
setupClaudeCmd.Flags().BoolVar(&setupRemove, "remove", false, "Remove bd hooks from Claude settings")
setupCursorCmd.Flags().BoolVar(&setupCheck, "check", false, "Check if Cursor integration is installed")
setupCursorCmd.Flags().BoolVar(&setupRemove, "remove", false, "Remove bd rules from Cursor")
setupAiderCmd.Flags().BoolVar(&setupCheck, "check", false, "Check if Aider integration is installed")
setupAiderCmd.Flags().BoolVar(&setupRemove, "remove", false, "Remove bd config from Aider")
setupCmd.AddCommand(setupClaudeCmd)
setupCmd.AddCommand(setupCursorCmd)
setupCmd.AddCommand(setupAiderCmd)
rootCmd.AddCommand(setupCmd)
}