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>
68 lines
1.5 KiB
Go
68 lines
1.5 KiB
Go
package git
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"github.com/steveyegge/beads/internal/storage/domain"
|
|
)
|
|
|
|
type testSuite struct {
|
|
suite.Suite
|
|
repo domain.GitRepository
|
|
tmpDir string
|
|
}
|
|
|
|
func (s *testSuite) SetupSuite() {
|
|
if _, err := exec.LookPath("git"); err != nil {
|
|
s.T().Skip("git binary not found")
|
|
}
|
|
}
|
|
|
|
func (s *testSuite) SetupTest() {
|
|
s.tmpDir = s.T().TempDir()
|
|
envDir := s.T().TempDir()
|
|
homeDir := filepath.Join(envDir, "home")
|
|
s.Require().NoError(os.MkdirAll(homeDir, 0700))
|
|
globalConfig := filepath.Join(homeDir, "gitconfig")
|
|
s.Require().NoError(os.WriteFile(globalConfig, nil, 0600))
|
|
s.T().Setenv("HOME", homeDir)
|
|
s.T().Setenv("USERPROFILE", homeDir)
|
|
s.T().Setenv("GIT_CONFIG_NOSYSTEM", "1")
|
|
s.T().Setenv("GIT_CONFIG_GLOBAL", globalConfig)
|
|
s.repo = NewGitRepository(s.tmpDir)
|
|
}
|
|
|
|
func (s *testSuite) Ctx() context.Context {
|
|
return context.Background()
|
|
}
|
|
|
|
func (s *testSuite) gitInit() {
|
|
s.T().Helper()
|
|
s.run("git", "init", "-q")
|
|
s.run("git", "config", "user.email", "test@example.com")
|
|
s.run("git", "config", "user.name", "test")
|
|
s.run("git", "config", "commit.gpgsign", "false")
|
|
}
|
|
|
|
func (s *testSuite) run(name string, args ...string) {
|
|
s.T().Helper()
|
|
cmd := exec.Command(name, args...)
|
|
cmd.Dir = s.tmpDir
|
|
s.Require().NoError(cmd.Run())
|
|
}
|
|
|
|
func (s *testSuite) writeFile(rel, body string) {
|
|
s.T().Helper()
|
|
s.Require().NoError(os.WriteFile(filepath.Join(s.tmpDir, rel), []byte(body), 0600))
|
|
}
|
|
|
|
func TestDomainGit(t *testing.T) {
|
|
suite.Run(t, &testSuite{})
|
|
}
|