beads/cmd/bd/setup/cursor.go
Marco Del Pin b7bd6d6fae fix: replace stale 'bd sync' references with bd dolt push/commit (GH#2435)
bd sync was removed as a command but references persisted in:
- CLI help text (--dolt-auto-commit flag description)
- Code comments (dolt_autocommit.go, init_contributor.go)
- Agent setup generators (aider, cursor, junie, mux)
- Doctor agent remediation commands
- Jujutsu hook alias (init_git_hooks.go)
- Copilot integration docs

All references now point to the current commands:
- bd dolt commit (for committing changes)
- bd dolt push (for pushing to remote)

Tests updated to match.

Complements #2389 (config/sync.mode removal) and #2419 (command removal).
Remaining stale references in other docs tracked in GH#2435.
2026-03-07 17:00:19 +01:00

96 lines
2.9 KiB
Go

package setup
import (
"fmt"
"os"
"path/filepath"
)
const cursorRulesTemplate = `# 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 <id> --claim # Claim work atomically
bd close <id> # Mark complete
bd dep add <issue> <depends-on> # 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 <id> --claim`" + `
3. Do the work
4. Mark complete: ` + "`bd close <id>`" + `
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")
}