RenderSection() and ReplaceSection() now accept RenderOpts with a HasRemote flag. When false, "bd dolt push" is stripped from the session-completion code block (and the Auto-Sync informational bullet in the full profile). This prevents agents from dutifully running a no-op every session on solo/local-only projects. bd init detects the remote via shouldWireInitRemote(); bd setup detects it by reading sync.remote / sync.git-remote from config.yaml. The existing no-arg RenderSection() and ReplaceSection() default to HasRemote=true for full backward compatibility. Closes beads-ozg.
36 lines
828 B
Go
36 lines
828 B
Go
package setup
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/steveyegge/beads/internal/templates/agents"
|
|
)
|
|
|
|
type exitCapture struct {
|
|
called bool
|
|
code int
|
|
}
|
|
|
|
func stubSetupExit(t *testing.T) *exitCapture {
|
|
t.Helper()
|
|
cap := &exitCapture{}
|
|
orig := setupExit
|
|
setupExit = func(code int) {
|
|
cap.called = true
|
|
cap.code = code
|
|
}
|
|
t.Cleanup(func() {
|
|
setupExit = orig
|
|
})
|
|
return cap
|
|
}
|
|
|
|
// stubDetectRenderOpts overrides detectRenderOptsImpl to return
|
|
// DefaultRenderOpts (HasRemote=true), matching what agents.RenderSection()
|
|
// produces. This prevents hash mismatches in tests where no beads config exists.
|
|
func stubDetectRenderOpts(t *testing.T) {
|
|
t.Helper()
|
|
orig := detectRenderOptsImpl
|
|
detectRenderOptsImpl = func() agents.RenderOpts { return agents.DefaultRenderOpts() }
|
|
t.Cleanup(func() { detectRenderOptsImpl = orig })
|
|
}
|