This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
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

69 lines
2.2 KiB
Go

package main
import (
"context"
"fmt"
"os"
"strings"
"github.com/steveyegge/beads/internal/beads"
"github.com/steveyegge/beads/internal/config"
"github.com/steveyegge/beads/internal/doltremote"
)
// resolveSyncRemote returns the effective sync remote URL.
// Resolution order:
// 1. sync.remote (primary — any Dolt-compatible remote URL)
// 2. sync.git-remote (deprecated fallback)
// 3. "" (not configured)
func resolveSyncRemote() string {
if v := config.GetString("sync.remote"); v != "" {
return v
}
return config.GetString("sync.git-remote")
}
// resolveSyncRemoteFromDir is like resolveSyncRemote but reads from a
// specific beads directory's config.yaml. Used by context_cmd, doctor,
// and other paths that operate on a resolved beads dir rather than CWD.
func resolveSyncRemoteFromDir(beadsDir string) string {
if v := config.GetStringFromDir(beadsDir, "sync.remote"); v != "" {
return v
}
return config.GetStringFromDir(beadsDir, "sync.git-remote")
}
// commitBeadsConfig stages .beads/config.yaml and commits it.
// Silently no-ops if the file is clean or the commit fails (e.g. hooks,
// nothing to commit). Used by bd dolt remote add/remove to keep the
// working tree clean after persisting sync.remote.
func commitBeadsConfig(msg string) {
commitBeadsConfigForActiveRepo(context.Background(), msg)
}
func commitBeadsConfigForActiveRepo(ctx context.Context, msg string) {
rc, err := beads.GetRepoContext()
if err != nil {
return
}
addCmd := rc.GitCmd(ctx, "add", ".beads/config.yaml")
if err := addCmd.Run(); err != nil {
return
}
commitCmd := rc.GitCmd(ctx, "commit", "-m", msg)
if out, err := commitCmd.CombinedOutput(); err != nil {
if !strings.Contains(string(out), "nothing to commit") {
fmt.Fprintf(os.Stderr, "Warning: failed to commit config change: %v\n", err)
}
}
}
// normalizeRemoteURL converts a remote URL to a Dolt-compatible format.
// Dolt-native URLs (dolthub://, file://, aws://, gs://, git+...) are
// returned as-is. Git URLs (https://, ssh://, git@...) are converted
// via gitURLToDoltRemote. Unknown schemes are returned as-is and let
// dolt clone decide.
func normalizeRemoteURL(url string) string {
return doltremote.Normalize(url)
}