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

53 lines
1013 B
Go

package pidfile
import (
"encoding/json"
"errors"
"io/fs"
"os"
"path/filepath"
"github.com/steveyegge/beads/internal/atomicfile"
)
type PidFile struct {
Pid int `json:"pid"`
Port int `json:"port"`
UpstreamID string `json:"upstream_id,omitempty"`
}
func Path(rootDir, name string) string {
return filepath.Join(rootDir, name)
}
func Read(rootDir, name string) (*PidFile, error) {
data, err := os.ReadFile(Path(rootDir, name))
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
return nil, nil
}
return nil, err
}
var pf PidFile
if err := json.Unmarshal(data, &pf); err != nil {
return nil, err
}
return &pf, nil
}
func Write(rootDir, name string, pf PidFile) error {
data, err := json.Marshal(pf)
if err != nil {
return err
}
return atomicfile.WriteFile(Path(rootDir, name), data, 0o644)
}
func Remove(rootDir, name string) error {
err := os.Remove(Path(rootDir, name))
if err != nil && !errors.Is(err, fs.ErrNotExist) {
return err
}
return nil
}