feat: Distinct prefixes for protos, molecules, wisps (bd-hobo)

Added type-specific ID prefixes for better visual recognition:
- `bd pour` now generates IDs with "mol-" prefix
- `bd wisp create` now generates IDs with "wisp-" prefix
- Regular issues continue using the configured prefix

Implementation:
- Added IDPrefix field to types.Issue (internal, not exported to JSONL)
- Added Prefix field to CloneOptions for spawning operations
- Added IDPrefix to RPC CreateArgs for daemon communication
- Updated storage layer to use issue.IDPrefix when generating IDs
- Updated pour.go and wisp.go to pass appropriate prefixes

This enables instant visual recognition of entity types and prevents
accidental modification of templates.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-25 02:05:06 -08:00
parent a643b9ab67
commit f78fe883d0
10 changed files with 38 additions and 14 deletions

View File

@@ -66,12 +66,14 @@ See also:
// This instantiates a proto (template) into a molecule (real issues).
// Wraps cloneSubgraph from template.go and returns InstantiateResult.
// If ephemeral is true, spawned issues are marked for bulk deletion when closed.
func spawnMolecule(ctx context.Context, s storage.Storage, subgraph *MoleculeSubgraph, vars map[string]string, assignee string, actorName string, ephemeral bool) (*InstantiateResult, error) {
// The prefix parameter overrides the default issue prefix (bd-hobo: distinct prefixes).
func spawnMolecule(ctx context.Context, s storage.Storage, subgraph *MoleculeSubgraph, vars map[string]string, assignee string, actorName string, ephemeral bool, prefix string) (*InstantiateResult, error) {
opts := CloneOptions{
Vars: vars,
Assignee: assignee,
Actor: actorName,
Wisp: ephemeral,
Prefix: prefix,
}
return cloneSubgraph(ctx, s, subgraph, opts)
}

View File

@@ -824,7 +824,7 @@ func TestSpawnWithBasicAttach(t *testing.T) {
}
vars := map[string]string{"feature": "auth"}
spawnResult, err := spawnMolecule(ctx, s, primarySubgraph, vars, "", "test", true)
spawnResult, err := spawnMolecule(ctx, s, primarySubgraph, vars, "", "test", true, "")
if err != nil {
t.Fatalf("Failed to spawn primary: %v", err)
}
@@ -934,7 +934,7 @@ func TestSpawnWithMultipleAttachments(t *testing.T) {
t.Fatalf("Failed to load primary subgraph: %v", err)
}
spawnResult, err := spawnMolecule(ctx, s, primarySubgraph, nil, "", "test", true)
spawnResult, err := spawnMolecule(ctx, s, primarySubgraph, nil, "", "test", true, "")
if err != nil {
t.Fatalf("Failed to spawn primary: %v", err)
}
@@ -1052,7 +1052,7 @@ func TestSpawnAttachTypes(t *testing.T) {
t.Fatalf("Failed to load primary subgraph: %v", err)
}
spawnResult, err := spawnMolecule(ctx, s, primarySubgraph, nil, "", "test", true)
spawnResult, err := spawnMolecule(ctx, s, primarySubgraph, nil, "", "test", true, "")
if err != nil {
t.Fatalf("Failed to spawn primary: %v", err)
}
@@ -1212,7 +1212,7 @@ func TestSpawnVariableAggregation(t *testing.T) {
}
// Spawn primary with variables
spawnResult, err := spawnMolecule(ctx, s, primarySubgraph, vars, "", "test", true)
spawnResult, err := spawnMolecule(ctx, s, primarySubgraph, vars, "", "test", true, "")
if err != nil {
t.Fatalf("Failed to spawn primary: %v", err)
}

View File

@@ -181,7 +181,8 @@ func runPour(cmd *cobra.Command, args []string) {
}
// Spawn as persistent mol (ephemeral=false)
result, err := spawnMolecule(ctx, store, subgraph, vars, assignee, actor, false)
// bd-hobo: Use "mol" prefix for distinct visual recognition
result, err := spawnMolecule(ctx, store, subgraph, vars, assignee, actor, false, "mol")
if err != nil {
fmt.Fprintf(os.Stderr, "Error pouring proto: %v\n", err)
os.Exit(1)

View File

@@ -44,6 +44,7 @@ type CloneOptions struct {
Assignee string // Assign the root epic to this agent/user
Actor string // Actor performing the operation
Wisp bool // If true, spawned issues are marked for bulk deletion
Prefix string // Override prefix for ID generation (bd-hobo: distinct prefixes)
// Dynamic bonding fields (for Christmas Ornament pattern)
ParentID string // Parent molecule ID to bond under (e.g., "patrol-x7k")
@@ -711,6 +712,7 @@ func cloneSubgraphViaDaemon(client *rpc.Client, subgraph *TemplateSubgraph, opts
Assignee: issueAssignee,
EstimatedMinutes: oldIssue.EstimatedMinutes,
Wisp: opts.Wisp,
IDPrefix: opts.Prefix, // bd-hobo: distinct prefixes for mols/wisps
}
// Generate custom ID for dynamic bonding if ParentID is set
@@ -905,7 +907,8 @@ func cloneSubgraph(ctx context.Context, s storage.Storage, subgraph *TemplateSub
IssueType: oldIssue.IssueType,
Assignee: issueAssignee,
EstimatedMinutes: oldIssue.EstimatedMinutes,
Wisp: opts.Wisp, // bd-2vh3: mark for cleanup when closed
Wisp: opts.Wisp, // bd-2vh3: mark for cleanup when closed
IDPrefix: opts.Prefix, // bd-hobo: distinct prefixes for mols/wisps
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}

View File

@@ -206,7 +206,8 @@ func runWispCreate(cmd *cobra.Command, args []string) {
}
// Spawn as wisp in main database (ephemeral=true sets Wisp flag, skips JSONL export)
result, err := spawnMolecule(ctx, store, subgraph, vars, "", actor, true)
// bd-hobo: Use "wisp" prefix for distinct visual recognition
result, err := spawnMolecule(ctx, store, subgraph, vars, "", actor, true, "wisp")
if err != nil {
fmt.Fprintf(os.Stderr, "Error creating wisp: %v\n", err)
os.Exit(1)