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.
gitgram-ai/aitimemachine/beads/internal/configfile/proxied_server_client_info.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

84 lines
2.2 KiB
Go

package configfile
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
)
const ProxiedServerClientInfoFileName = "proxied_server_client_info.json"
type ProxiedServerClientInfo struct {
RootPath string `json:"root_path,omitempty"`
ConfigPath string `json:"config_path,omitempty"`
LogPath string `json:"log_path,omitempty"`
External *ExternalDoltConfig `json:"external,omitempty"`
}
func ProxiedServerClientInfoPath(beadsDir string) string {
return filepath.Join(beadsDir, ProxiedServerClientInfoFileName)
}
func LoadProxiedServerClientInfo(beadsDir string) (*ProxiedServerClientInfo, error) {
path := ProxiedServerClientInfoPath(beadsDir)
data, err := os.ReadFile(path) // #nosec G304 - controlled path
if os.IsNotExist(err) {
return nil, nil
}
if err != nil {
return nil, fmt.Errorf("reading %s: %w", ProxiedServerClientInfoFileName, err)
}
var info ProxiedServerClientInfo
if err := json.Unmarshal(data, &info); err != nil {
return nil, fmt.Errorf("parsing %s: %w", ProxiedServerClientInfoFileName, err)
}
return &info, nil
}
func SaveProxiedServerClientInfo(beadsDir string, info *ProxiedServerClientInfo) error {
if info == nil {
info = &ProxiedServerClientInfo{}
}
data, err := json.MarshalIndent(info, "", " ")
if err != nil {
return fmt.Errorf("marshaling %s: %w", ProxiedServerClientInfoFileName, err)
}
path := ProxiedServerClientInfoPath(beadsDir)
if err := os.WriteFile(path, data, 0o600); err != nil {
return fmt.Errorf("writing %s: %w", ProxiedServerClientInfoFileName, err)
}
return nil
}
func resolveSidecarPath(beadsDir, p string) string {
if p == "" {
return ""
}
if filepath.IsAbs(p) {
return p
}
return filepath.Join(beadsDir, p)
}
func (i *ProxiedServerClientInfo) ResolvedRootPath(beadsDir string) string {
if i == nil {
return ""
}
return resolveSidecarPath(beadsDir, i.RootPath)
}
func (i *ProxiedServerClientInfo) ResolvedConfigPath(beadsDir string) string {
if i == nil {
return ""
}
return resolveSidecarPath(beadsDir, i.ConfigPath)
}
func (i *ProxiedServerClientInfo) ResolvedLogPath(beadsDir string) string {
if i == nil {
return ""
}
return resolveSidecarPath(beadsDir, i.LogPath)
}