feat(molecules): Add molecules.jsonl as separate catalog file for templates
Implements gt-0ei3: Template molecules now live in a separate molecules.jsonl file, distinct from work items in issues.jsonl. Key changes: - Add internal/molecules package for loading molecule catalogs - Implement hierarchical loading: built-in → town → user → project - Molecules use their own ID namespace (mol-*) with prefix validation skipped - Templates are marked with is_template: true and are read-only - bd list excludes templates by default (existing functionality) The hierarchical loading allows: - Built-in molecules shipped with bd binary (placeholder for future) - Town-level: ~/gt/.beads/molecules.jsonl (Gas Town) - User-level: ~/.beads/molecules.jsonl - Project-level: .beads/molecules.jsonl 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/steveyegge/beads/internal/config"
|
||||
"github.com/steveyegge/beads/internal/debug"
|
||||
"github.com/steveyegge/beads/internal/hooks"
|
||||
"github.com/steveyegge/beads/internal/molecules"
|
||||
"github.com/steveyegge/beads/internal/rpc"
|
||||
"github.com/steveyegge/beads/internal/storage"
|
||||
"github.com/steveyegge/beads/internal/storage/memory"
|
||||
@@ -633,6 +634,19 @@ var rootCmd = &cobra.Command{
|
||||
autoImportIfNewer()
|
||||
}
|
||||
}
|
||||
|
||||
// Load molecule templates from hierarchical catalog locations (gt-0ei3)
|
||||
// Templates are loaded after auto-import to ensure the database is up-to-date.
|
||||
// Skip for import command to avoid conflicts during import operations.
|
||||
if cmd.Name() != "import" && store != nil {
|
||||
beadsDir := filepath.Dir(dbPath)
|
||||
loader := molecules.NewLoader(store)
|
||||
if result, err := loader.LoadAll(rootCtx, beadsDir); err != nil {
|
||||
debug.Logf("warning: failed to load molecules: %v", err)
|
||||
} else if result.Loaded > 0 {
|
||||
debug.Logf("loaded %d molecules from %v", result.Loaded, result.Sources)
|
||||
}
|
||||
}
|
||||
},
|
||||
PersistentPostRun: func(cmd *cobra.Command, args []string) {
|
||||
// Handle --no-db mode: write memory storage back to JSONL
|
||||
|
||||
Reference in New Issue
Block a user