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>
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/steveyegge/beads/internal/beads"
|
|
)
|
|
|
|
// ensureDirectMode makes sure the CLI is operating in direct-storage mode.
|
|
func ensureDirectMode(_ string) error {
|
|
return ensureStoreActive()
|
|
}
|
|
|
|
// ensureStoreActive guarantees that a storage backend is initialized and tracked.
|
|
// Uses the factory to respect metadata.json backend configuration.
|
|
func ensureStoreActive() error {
|
|
return ensureStoreActiveWithContext(getRootContext())
|
|
}
|
|
|
|
func ensureStoreActiveWithContext(ctx context.Context) error {
|
|
if ctx == nil {
|
|
ctx = context.Background()
|
|
}
|
|
|
|
lockStore()
|
|
active := isStoreActive() && getStore() != nil
|
|
unlockStore()
|
|
if active {
|
|
return nil
|
|
}
|
|
|
|
// Find the .beads directory
|
|
beadsDir := beads.FindBeadsDir()
|
|
if beadsDir == "" {
|
|
return fmt.Errorf("no beads database found.\n" +
|
|
"Hint: run 'bd init' to create a database in the current directory")
|
|
}
|
|
|
|
// Use the factory to create the appropriate backend
|
|
// based on metadata.json configuration and build tags
|
|
store, err := newDoltStoreFromConfig(ctx, beadsDir)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to open database: %w\nHint: %s", err, diagHint())
|
|
}
|
|
|
|
// Update the database path for compatibility with code that expects it
|
|
if dbPath := beads.FindDatabasePath(); dbPath != "" {
|
|
setDBPath(dbPath)
|
|
}
|
|
|
|
lockStore()
|
|
setStore(store)
|
|
setStoreActive(true)
|
|
unlockStore()
|
|
|
|
return nil
|
|
}
|