gitgram/aitimemachine/beads/cmd/bd/dolt_worktree_remote_test.go
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

63 lines
1.8 KiB
Go

//go:build cgo
package main
import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
"testing"
"github.com/steveyegge/beads/internal/testutil"
)
func TestDoltRemoteAddPersistsSyncRemoteToSharedWorktreeConfig(t *testing.T) {
skipIfNoDolt(t)
if runtime.GOOS == "windows" {
t.Skip("Skipping worktree test on Windows")
}
bd := buildBDForInitTests(t)
bareDir, worktreeDir := setupBareParentInitWorktree(t)
bareBeadsDir := filepath.Join(bareDir, ".beads")
port, err := testutil.FindFreePort()
if err != nil {
t.Fatalf("find free port: %v", err)
}
sharedEnv := append(os.Environ(),
"BEADS_DOLT_SHARED_SERVER=1",
"BEADS_DOLT_SERVER_PORT="+strconv.Itoa(port),
)
initCmd := exec.Command(bd, "init", "--prefix", "remote-sync", "--skip-hooks", "--quiet")
initCmd.Dir = worktreeDir
initCmd.Env = sharedEnv
if out, err := initCmd.CombinedOutput(); err != nil {
t.Fatalf("bd init from bare-parent worktree failed: %v\n%s", err, out)
}
remoteURL := "git+ssh://git@example.com/acme/beads.git"
addCmd := exec.Command(bd, "dolt", "remote", "add", "origin", remoteURL)
addCmd.Dir = worktreeDir
addCmd.Env = sharedEnv
if out, err := addCmd.CombinedOutput(); err != nil {
t.Fatalf("bd dolt remote add from bare-parent worktree failed: %v\n%s", err, out)
}
configPath := filepath.Join(bareBeadsDir, "config.yaml")
content, err := os.ReadFile(configPath)
if err != nil {
t.Fatalf("failed to read shared config.yaml: %v", err)
}
if !strings.Contains(string(content), `sync.remote: "`+remoteURL+`"`) {
t.Fatalf("expected shared config.yaml to contain sync.remote, got:\n%s", string(content))
}
if _, err := os.Stat(filepath.Join(worktreeDir, ".beads")); !os.IsNotExist(err) {
t.Fatalf("expected no worktree-local .beads directory after remote add, got err=%v", err)
}
}