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

104 lines
2.6 KiB
Go

package main
import (
"fmt"
"strings"
"github.com/steveyegge/beads/internal/config"
"github.com/steveyegge/beads/internal/storage/domain"
"github.com/steveyegge/beads/internal/types"
)
func parseDepSpecs(deps []string) ([]domain.DependencySpec, error) {
var out []domain.DependencySpec
for _, raw := range deps {
raw = strings.TrimSpace(raw)
if raw == "" {
continue
}
spec, err := parseDepSpec(raw)
if err != nil {
return nil, err
}
out = append(out, spec)
}
return out, nil
}
func parseDepSpec(raw string) (domain.DependencySpec, error) {
if !strings.Contains(raw, ":") {
return domain.DependencySpec{
Type: types.DepBlocks,
TargetID: raw,
}, nil
}
parts := strings.SplitN(raw, ":", 2)
if len(parts) != 2 {
return domain.DependencySpec{}, fmt.Errorf("invalid dependency format %q, expected 'type:id' or 'id'", raw)
}
rawType := types.DependencyType(strings.TrimSpace(parts[0]))
target := strings.TrimSpace(parts[1])
spec := domain.DependencySpec{TargetID: target}
switch rawType {
case "depends-on", "blocked-by":
spec.Type = types.DepBlocks
case types.DepBlocks:
spec.Type = types.DepBlocks
spec.SwapDirection = true
default:
spec.Type = rawType
}
if !spec.Type.IsValid() {
return domain.DependencySpec{}, fmt.Errorf("invalid dependency type %q (must be non-empty, max 50 chars); valid types: %s",
spec.Type, createDepsAcceptedTypeList())
}
if !spec.Type.IsWellKnown() {
return domain.DependencySpec{}, fmt.Errorf("unknown dependency type %q; valid types: %s",
spec.Type, createDepsAcceptedTypeList())
}
return spec, nil
}
func buildWaitsFor(spawnerID, gate string) (*domain.WaitsForSpec, error) {
spawnerID = strings.TrimSpace(spawnerID)
if spawnerID == "" {
return nil, nil
}
if gate == "" {
gate = types.WaitsForAllChildren
}
if gate != types.WaitsForAllChildren && gate != types.WaitsForAnyChildren {
return nil, fmt.Errorf("invalid --waits-for-gate value %q (valid: all-children, any-children)", gate)
}
return &domain.WaitsForSpec{SpawnerID: spawnerID, Gate: gate}, nil
}
func discoveredFromParent(deps []string) string {
for _, raw := range deps {
raw = strings.TrimSpace(raw)
if raw == "" || !strings.Contains(raw, ":") {
continue
}
parts := strings.SplitN(raw, ":", 2)
if len(parts) != 2 {
continue
}
depType := types.DependencyType(strings.TrimSpace(parts[0]))
target := strings.TrimSpace(parts[1])
if depType == types.DepDiscoveredFrom && target != "" {
return target
}
}
return ""
}
func overlayYAMLPrefix(dbPrefix string) string {
if v := strings.TrimSpace(config.GetString("issue-prefix")); v != "" {
return v
}
return dbPrefix
}