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>
79 lines
2.2 KiB
Go
79 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var molSeedCmd = &cobra.Command{
|
|
Use: "seed <formula-name>",
|
|
Short: "Verify formula accessibility",
|
|
Long: `Verify that a formula is accessible and can be cooked.
|
|
|
|
The seed command checks formula search paths to ensure a formula exists
|
|
and can be loaded. This is useful for verifying system health before
|
|
attempting to spawn work from a formula.
|
|
|
|
Formula search paths (checked in order):
|
|
1. <resolved-beads-dir>/formulas/ (active project)
|
|
2. <checkout-root>/.beads/formulas/ (repo-local formulas)
|
|
3. ~/.beads/formulas/ (user level)
|
|
4. $GT_ROOT/.beads/formulas/ (shared workspace root, if GT_ROOT set)
|
|
|
|
Examples:
|
|
bd mol seed mol-feature # Verify specific formula
|
|
bd mol seed mol-review --var name=test # Verify with variable substitution`,
|
|
Args: cobra.ExactArgs(1),
|
|
Run: runMolSeed,
|
|
}
|
|
|
|
func runMolSeed(cmd *cobra.Command, args []string) {
|
|
varFlags, _ := cmd.Flags().GetStringArray("var")
|
|
|
|
// Parse variables (for formula condition filtering if needed)
|
|
vars := make(map[string]string)
|
|
for _, v := range varFlags {
|
|
parts := strings.SplitN(v, "=", 2)
|
|
if len(parts) != 2 {
|
|
FatalError("invalid variable format '%s', expected 'key=value'", v)
|
|
}
|
|
vars[parts[0]] = parts[1]
|
|
}
|
|
|
|
// Verify single formula
|
|
formulaName := args[0]
|
|
if err := verifyFormula(formulaName, vars); err != nil {
|
|
FatalError("%v", err)
|
|
}
|
|
|
|
if !jsonOutput {
|
|
fmt.Printf("✓ Formula %q accessible\n", formulaName)
|
|
} else {
|
|
outputJSON(map[string]interface{}{
|
|
"status": "ok",
|
|
"formula": formulaName,
|
|
})
|
|
}
|
|
}
|
|
|
|
// verifyFormula checks if a formula can be loaded and cooked
|
|
func verifyFormula(formulaName string, vars map[string]string) error {
|
|
// Try to cook the formula - this verifies:
|
|
// 1. Formula exists in search path
|
|
// 2. Formula syntax is valid
|
|
// 3. Formula can be resolved (extends, etc.)
|
|
// 4. Formula can be cooked to subgraph
|
|
_, err := resolveAndCookFormulaWithVars(formulaName, nil, vars)
|
|
if err != nil {
|
|
return fmt.Errorf("formula %q not accessible: %w", formulaName, err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
molSeedCmd.Flags().StringArray("var", []string{}, "Variable substitution for condition filtering (key=value)")
|
|
molCmd.AddCommand(molSeedCmd)
|
|
}
|