Move pour and ephemeral under bd mol subcommand (bd-2fs7)
For consistency, all molecule operations are now under bd mol: - bd mol pour <proto> - create persistent mol - bd mol ephemeral <proto> - create ephemeral mol - bd mol ephemeral list - list ephemeral issues - bd mol ephemeral gc - garbage collect old ephemeral issues This aligns with existing mol subcommands: bond, squash, burn, etc.
This commit is contained in:
@@ -27,24 +27,34 @@ import (
|
|||||||
// bd ephemeral gc - Garbage collect orphaned ephemeral issues
|
// bd ephemeral gc - Garbage collect orphaned ephemeral issues
|
||||||
|
|
||||||
var ephemeralCmd = &cobra.Command{
|
var ephemeralCmd = &cobra.Command{
|
||||||
Use: "ephemeral",
|
Use: "ephemeral [proto-id]",
|
||||||
Short: "Manage ephemeral molecules",
|
Short: "Create or manage ephemeral molecules",
|
||||||
Long: `Manage ephemeral issues - ephemeral molecules for operational workflows.
|
Long: `Create or manage ephemeral issues - ephemeral molecules for operational workflows.
|
||||||
|
|
||||||
Ephemeral issues are issues with Wisp=true in the main database. They're stored
|
When called with a proto-id argument, creates an ephemeral mol from that proto.
|
||||||
|
When called with a subcommand (list, gc), manages existing ephemeral issues.
|
||||||
|
|
||||||
|
Ephemeral issues are issues with Ephemeral=true in the main database. They're stored
|
||||||
locally but NOT exported to JSONL (and thus not synced via git).
|
locally but NOT exported to JSONL (and thus not synced via git).
|
||||||
They're used for patrol cycles, operational loops, and other workflows
|
They're used for patrol cycles, operational loops, and other workflows
|
||||||
that shouldn't accumulate in the shared issue database.
|
that shouldn't accumulate in the shared issue database.
|
||||||
|
|
||||||
The wisp lifecycle:
|
The ephemeral lifecycle:
|
||||||
1. Create: bd ephemeral create <proto> or bd create --ephemeral
|
1. Create: bd mol ephemeral <proto> or bd create --ephemeral
|
||||||
2. Execute: Normal bd operations work on ephemeral issues
|
2. Execute: Normal bd operations work on ephemeral issues
|
||||||
3. Squash: bd mol squash <id> (clears Wisp flag, promotes to persistent)
|
3. Squash: bd mol squash <id> (clears Ephemeral flag, promotes to persistent)
|
||||||
4. Or burn: bd mol burn <id> (deletes wisp without creating digest)
|
4. Or burn: bd mol burn <id> (deletes without creating digest)
|
||||||
|
|
||||||
Commands:
|
Examples:
|
||||||
|
bd mol ephemeral mol-patrol # Create ephemeral from proto
|
||||||
|
bd mol ephemeral list # List all ephemeral issues
|
||||||
|
bd mol ephemeral gc # Garbage collect old ephemeral issues
|
||||||
|
|
||||||
|
Subcommands:
|
||||||
list List all ephemeral issues in current context
|
list List all ephemeral issues in current context
|
||||||
gc Garbage collect orphaned ephemeral issues`,
|
gc Garbage collect orphaned ephemeral issues`,
|
||||||
|
Args: cobra.MaximumNArgs(1),
|
||||||
|
Run: runEphemeral,
|
||||||
}
|
}
|
||||||
|
|
||||||
// EphemeralListItem represents a wisp in list output
|
// EphemeralListItem represents a wisp in list output
|
||||||
@@ -68,7 +78,19 @@ type EphemeralListResult struct {
|
|||||||
// OldThreshold is how old a wisp must be to be flagged as old (time-based, for ephemeral cleanup)
|
// OldThreshold is how old a wisp must be to be flagged as old (time-based, for ephemeral cleanup)
|
||||||
const OldThreshold = 24 * time.Hour
|
const OldThreshold = 24 * time.Hour
|
||||||
|
|
||||||
// ephemeralCreateCmd instantiates a proto as an ephemeral wisp
|
// runEphemeral handles the ephemeral command when called directly with a proto-id
|
||||||
|
// It delegates to runEphemeralCreate for the actual work
|
||||||
|
func runEphemeral(cmd *cobra.Command, args []string) {
|
||||||
|
if len(args) == 0 {
|
||||||
|
// No proto-id provided, show help
|
||||||
|
cmd.Help()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Delegate to the create logic
|
||||||
|
runEphemeralCreate(cmd, args)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ephemeralCreateCmd instantiates a proto as an ephemeral wisp (kept for backwards compat)
|
||||||
var ephemeralCreateCmd = &cobra.Command{
|
var ephemeralCreateCmd = &cobra.Command{
|
||||||
Use: "create <proto-id>",
|
Use: "create <proto-id>",
|
||||||
Short: "Instantiate a proto as an ephemeral wisp (solid -> vapor)",
|
Short: "Instantiate a proto as an ephemeral wisp (solid -> vapor)",
|
||||||
@@ -634,7 +656,11 @@ func runEphemeralGC(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Ephemeral create command flags
|
// Ephemeral command flags (for direct create: bd mol ephemeral <proto>)
|
||||||
|
ephemeralCmd.Flags().StringSlice("var", []string{}, "Variable substitution (key=value)")
|
||||||
|
ephemeralCmd.Flags().Bool("dry-run", false, "Preview what would be created")
|
||||||
|
|
||||||
|
// Ephemeral create command flags (kept for backwards compat: bd mol ephemeral create <proto>)
|
||||||
ephemeralCreateCmd.Flags().StringSlice("var", []string{}, "Variable substitution (key=value)")
|
ephemeralCreateCmd.Flags().StringSlice("var", []string{}, "Variable substitution (key=value)")
|
||||||
ephemeralCreateCmd.Flags().Bool("dry-run", false, "Preview what would be created")
|
ephemeralCreateCmd.Flags().Bool("dry-run", false, "Preview what would be created")
|
||||||
|
|
||||||
@@ -647,5 +673,5 @@ func init() {
|
|||||||
ephemeralCmd.AddCommand(ephemeralCreateCmd)
|
ephemeralCmd.AddCommand(ephemeralCreateCmd)
|
||||||
ephemeralCmd.AddCommand(ephemeralListCmd)
|
ephemeralCmd.AddCommand(ephemeralListCmd)
|
||||||
ephemeralCmd.AddCommand(ephemeralGCCmd)
|
ephemeralCmd.AddCommand(ephemeralGCCmd)
|
||||||
rootCmd.AddCommand(ephemeralCmd)
|
molCmd.AddCommand(ephemeralCmd)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import (
|
|||||||
// Usage:
|
// Usage:
|
||||||
// bd mol catalog # List available protos
|
// bd mol catalog # List available protos
|
||||||
// bd mol show <id> # Show proto/molecule structure
|
// bd mol show <id> # Show proto/molecule structure
|
||||||
// bd pour <id> --var key=value # Instantiate proto → persistent mol
|
// bd mol pour <id> --var key=value # Instantiate proto → persistent mol
|
||||||
// bd ephemeral create <id> --var key=value # Instantiate proto → ephemeral wisp
|
// bd mol ephemeral <id> --var key=value # Instantiate proto → ephemeral mol
|
||||||
|
|
||||||
// MoleculeLabel is the label used to identify molecules (templates)
|
// MoleculeLabel is the label used to identify molecules (templates)
|
||||||
// Molecules use the same label as templates - they ARE templates with workflow semantics
|
// Molecules use the same label as templates - they ARE templates with workflow semantics
|
||||||
@@ -48,14 +48,14 @@ The molecule metaphor:
|
|||||||
- Distilling extracts a proto from an ad-hoc epic
|
- Distilling extracts a proto from an ad-hoc epic
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
catalog List available protos
|
catalog List available protos
|
||||||
show Show proto/molecule structure and variables
|
show Show proto/molecule structure and variables
|
||||||
bond Polymorphic combine: proto+proto, proto+mol, mol+mol
|
pour Instantiate proto as persistent mol (liquid phase)
|
||||||
distill Extract proto from ad-hoc epic
|
ephemeral Instantiate proto as ephemeral mol (vapor phase)
|
||||||
|
bond Polymorphic combine: proto+proto, proto+mol, mol+mol
|
||||||
See also:
|
squash Condense molecule to digest
|
||||||
bd pour <proto> # Instantiate as persistent mol (liquid phase)
|
burn Discard ephemeral mol
|
||||||
bd ephemeral create <proto> # Instantiate as ephemeral wisp (vapor phase)`,
|
distill Extract proto from ad-hoc epic`,
|
||||||
}
|
}
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ Use pour for:
|
|||||||
- Anything you might need to reference later
|
- Anything you might need to reference later
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
bd pour mol-feature --var name=auth # Create persistent mol from proto
|
bd mol pour mol-feature --var name=auth # Create persistent mol from proto
|
||||||
bd pour mol-release --var version=1.0 # Release workflow
|
bd mol pour mol-release --var version=1.0 # Release workflow
|
||||||
bd pour mol-review --var pr=123 # Code review workflow`,
|
bd mol pour mol-review --var pr=123 # Code review workflow`,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
Run: runPour,
|
Run: runPour,
|
||||||
}
|
}
|
||||||
@@ -260,5 +260,5 @@ func init() {
|
|||||||
pourCmd.Flags().StringSlice("attach", []string{}, "Proto to attach after spawning (repeatable)")
|
pourCmd.Flags().StringSlice("attach", []string{}, "Proto to attach after spawning (repeatable)")
|
||||||
pourCmd.Flags().String("attach-type", types.BondTypeSequential, "Bond type for attachments: sequential, parallel, or conditional")
|
pourCmd.Flags().String("attach-type", types.BondTypeSequential, "Bond type for attachments: sequential, parallel, or conditional")
|
||||||
|
|
||||||
rootCmd.AddCommand(pourCmd)
|
molCmd.AddCommand(pourCmd)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user