package setup import ( "fmt" "os" "path/filepath" ) const cursorRulesTemplate = `--- alwaysApply: true --- # Beads Issue Tracking # Auto-generated by 'bd setup cursor' - do not remove these markers # BEGIN BEADS INTEGRATION This project uses [Beads (bd)](https://github.com/steveyegge/beads) for issue tracking. ## Core Rules - Track ALL work in bd (never use markdown TODOs or comment-based task lists) - Use ` + "`bd ready`" + ` to find available work - Use ` + "`bd create`" + ` to track new issues/tasks/bugs - Use ` + "`bd dolt push`" + ` at end of session to sync with git remote - Git hooks auto-sync on commit/merge ## Quick Reference ` + "```bash" + ` bd prime # Load complete workflow context bd ready # Show issues ready to work (no blockers) bd list --status=open # List all open issues bd create --title="..." --type=task # Create new issue bd update --claim # Claim work atomically bd close # Mark complete bd dep add # Add dependency (issue depends on depends-on) bd dolt push # Sync with git remote ` + "```" + ` ## Workflow 1. Check for ready work: ` + "`bd ready`" + ` 2. Claim an issue atomically: ` + "`bd update --claim`" + ` 3. Do the work 4. Mark complete: ` + "`bd close `" + ` 5. Sync: ` + "`bd dolt push`" + ` (or let git hooks handle it) ## Context Loading Run ` + "`bd prime`" + ` to get complete workflow documentation in AI-optimized format (~1-2k tokens). For detailed docs: see AGENTS.md, QUICKSTART.md, or run ` + "`bd --help`" + ` # END BEADS INTEGRATION ` // InstallCursor installs Cursor IDE integration func InstallCursor() { rulesPath := ".cursor/rules/beads.mdc" fmt.Println("Installing Cursor integration...") // Ensure parent directory exists if err := EnsureDir(filepath.Dir(rulesPath), 0755); err != nil { FatalError("%v", err) } // Write beads rules file (overwrite if exists) if err := atomicWriteFile(rulesPath, []byte(cursorRulesTemplate)); err != nil { FatalError("write rules: %v", err) } fmt.Printf("\nāœ“ Cursor integration installed\n") fmt.Printf(" Rules: %s\n", rulesPath) fmt.Println("\nRestart Cursor for changes to take effect.") } // CheckCursor checks if Cursor integration is installed func CheckCursor() { rulesPath := ".cursor/rules/beads.mdc" if !FileExists(rulesPath) { FatalErrorWithHint("Cursor integration not installed", "Run: bd setup cursor") } fmt.Println("āœ“ Cursor integration installed:", rulesPath) } // RemoveCursor removes Cursor integration func RemoveCursor() { rulesPath := ".cursor/rules/beads.mdc" fmt.Println("Removing Cursor integration...") if err := os.Remove(rulesPath); err != nil { if os.IsNotExist(err) { fmt.Println("No rules file found") return } FatalError("failed to remove file: %v", err) } fmt.Println("āœ“ Removed Cursor integration") }