fix(session): Set BEADS_DIR to town-level beads for polecat hooks
Polecats need access to town-level beads (hq- prefix) for hooks and convoys. Update session manager to set BEADS_DIR to town root .beads/ instead of rig-level .beads/. Also update mail.go's findLocalBeadsDir() to respect the BEADS_DIR environment variable, which is necessary for polecats using redirect-based beads access.
This commit is contained in:
@@ -925,7 +925,24 @@ func findMailWorkDir() (string, error) {
|
||||
|
||||
// findLocalBeadsDir finds the nearest .beads directory by walking up from CWD.
|
||||
// Used for project work (molecules, issue creation) that uses clone beads.
|
||||
//
|
||||
// Priority:
|
||||
// 1. BEADS_DIR environment variable (set by session manager for polecats)
|
||||
// 2. Walk up from CWD looking for .beads directory
|
||||
//
|
||||
// Polecats use redirect-based beads access, so their worktree doesn't have a full
|
||||
// .beads directory. The session manager sets BEADS_DIR to the correct location.
|
||||
func findLocalBeadsDir() (string, error) {
|
||||
// Check BEADS_DIR environment variable first (set by session manager for polecats).
|
||||
// This is important for polecats that use redirect-based beads access.
|
||||
if beadsDir := os.Getenv("BEADS_DIR"); beadsDir != "" {
|
||||
// BEADS_DIR points directly to the .beads directory, return its parent
|
||||
if _, err := os.Stat(beadsDir); err == nil {
|
||||
return filepath.Dir(beadsDir), nil
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: walk up from CWD
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in New Issue
Block a user